mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-11 19:19:35 +02:00
Completion for kitty @ action
This commit is contained in:
26
tools/cmd/at/complete_actions.go
Normal file
26
tools/cmd/at/complete_actions.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// License: GPLv3 Copyright: 2024, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||
|
||||
package at
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"kitty/tools/cli"
|
||||
"kitty/tools/utils"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
|
||||
func complete_actions(completions *cli.Completions, word string, arg_num int) {
|
||||
if arg_num < 2 {
|
||||
scanner := utils.NewLineScanner(KittyActionNames)
|
||||
mg := completions.AddMatchGroup("Actions")
|
||||
for scanner.Scan() {
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
if line != "" && strings.HasPrefix(line, word) {
|
||||
mg.AddMatch(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user