Basic completion for options

This commit is contained in:
Kovid Goyal
2022-11-14 15:41:57 +05:30
parent 18c3e46ac6
commit c5afceb4cb
5 changed files with 83 additions and 41 deletions
+4 -1
View File
@@ -6,7 +6,6 @@ import "strings"
type Match struct {
Word string `json:"word,omitempty"`
FullForm string `json:"full_form,omitempty"`
Description string `json:"description,omitempty"`
}
@@ -123,6 +122,10 @@ func (self *Command) has_subcommands() bool {
return false
}
func (self *Command) add_option(opt *Option) {
self.Options = append(self.Options, opt)
}
func (self *Command) GetCompletions(argv []string) *Completions {
ans := Completions{Groups: make([]*MatchGroup, 0, 4)}
if len(argv) > 0 {