mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-31 06:18:17 +00:00
Completion for kitty @ action
This commit is contained in:
parent
54548931b5
commit
97e2d41233
3 changed files with 40 additions and 1 deletions
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue