Ensure auto-generated entries such as --help are present for completion by calling Validate()
This commit is contained in:
parent
81916d0f02
commit
e31587ec1e
@ -88,6 +88,7 @@ func GenerateCompletions(args []string) error {
|
|||||||
re(root)
|
re(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root.Validate()
|
||||||
all_completions := make([]*Completions, 0, 1)
|
all_completions := make([]*Completions, 0, 1)
|
||||||
for _, argv := range all_argv {
|
for _, argv := range all_argv {
|
||||||
all_completions = append(all_completions, root.GetCompletions(argv, init_completions[output_type]))
|
all_completions = append(all_completions, root.GetCompletions(argv, init_completions[output_type]))
|
||||||
|
|||||||
@ -186,6 +186,7 @@ func completions(before_cursor, after_cursor string) (ans *cli.Completions) {
|
|||||||
root := cli.NewRootCommand()
|
root := cli.NewRootCommand()
|
||||||
c := root.AddSubCommand(&cli.Command{Name: "kitty-tool"})
|
c := root.AddSubCommand(&cli.Command{Name: "kitty-tool"})
|
||||||
EntryPoint(c)
|
EntryPoint(c)
|
||||||
|
root.Validate()
|
||||||
ans = root.GetCompletions(argv, nil)
|
ans = root.GetCompletions(argv, nil)
|
||||||
ans.CurrentWordIdx = position_of_last_arg - len(prefix)
|
ans.CurrentWordIdx = position_of_last_arg - len(prefix)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import (
|
|||||||
var _ = fmt.Print
|
var _ = fmt.Print
|
||||||
|
|
||||||
func KittyToolEntryPoints(root *cli.Command) {
|
func KittyToolEntryPoints(root *cli.Command) {
|
||||||
|
root.Add(cli.OptionSpec{
|
||||||
|
Name: "--version", Type: "bool-set", Help: "The current kitty version."})
|
||||||
// @
|
// @
|
||||||
at.EntryPoint(root)
|
at.EntryPoint(root)
|
||||||
// update-self
|
// update-self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user