More work on merging completions with parse tree

This commit is contained in:
Kovid Goyal
2022-09-26 07:34:49 +05:30
parent bf74413c1f
commit 97716fea8b
16 changed files with 263 additions and 426 deletions

View File

@@ -42,9 +42,16 @@ func init() {
output_serializers["json"] = json_output_serializer
}
var registered_exes = make(map[string]func(root *Command))
var registered_exes []func(root *Command)
func Main(args []string) error {
func RegisterExeForCompletion(x func(root *Command)) {
if registered_exes == nil {
registered_exes = make([]func(root *Command), 0, 4)
}
registered_exes = append(registered_exes, x)
}
func GenerateCompletions(args []string) error {
output_type := "json"
if len(args) > 0 {
output_type = args[0]