Move completion package into cli

This commit is contained in:
Kovid Goyal
2022-09-25 18:42:13 +05:30
parent 3662efdf80
commit 97acb60981
13 changed files with 53 additions and 47 deletions

View File

@@ -4,17 +4,28 @@ package main
import (
"kitty/tools/cli"
"kitty/tools/cli/completion"
"kitty/tools/cmd/at"
"kitty/tools/completion"
)
func completion_entry_point(tool_root *cli.Command) {
tool_root.AddSubCommand(&cli.Command{
Name: "__complete__", Hidden: true,
Usage: "output_type [shell state...]",
ShortDescription: "Generate completions for kitty commands",
HelpText: "Generate completion candidates for kitty commands. The command line is read from STDIN. output_type can be one of the supported shells or 'json' for JSON output.",
Run: func(cmd *cli.Command, args []string) (ret int, err error) {
return ret, completion.Main(args)
},
})
}
func main() {
root := cli.NewRootCommand()
root.ShortDescription = "Fast, statically compiled implementations for various kitty command-line tools"
root.Usage = "command [command options] [command args]"
at.EntryPoint(root)
completion.EntryPoint(root)
completion_entry_point(root)
root.Exec()
}