Get zsh completion working apart from delegation

This commit is contained in:
Kovid Goyal
2022-09-19 08:54:54 +05:30
parent cbbda23e01
commit 2cc359ccc8
7 changed files with 160 additions and 6 deletions

View File

@@ -55,12 +55,17 @@ func (self *Completions) add_options_group(options []*Option, word string) {
if word == "-" {
group.Matches = append(group.Matches, &Match{Word: "--", Description: "End of options"})
for _, opt := range options {
has_single_letter_alias := false
for _, q := range opt.Aliases {
if len(q) == 1 {
group.add_match("-"+q, opt.Description)
has_single_letter_alias = true
break
}
}
if !has_single_letter_alias {
group.add_match("--"+opt.Aliases[0], opt.Description)
}
}
} else {
runes := []rune(word)