explicitly ignore a few errors
This commit is contained in:
parent
3f65ce0e71
commit
2b66775f45
@ -263,7 +263,7 @@ func (self *Command) VisitAllOptions(callback func(*Option) error) error {
|
|||||||
|
|
||||||
func (self *Command) AllOptions() []*Option {
|
func (self *Command) AllOptions() []*Option {
|
||||||
ans := make([]*Option, 0, 64)
|
ans := make([]*Option, 0, 64)
|
||||||
self.VisitAllOptions(func(o *Option) error { ans = append(ans, o); return nil })
|
_ = self.VisitAllOptions(func(o *Option) error { ans = append(ans, o); return nil })
|
||||||
return ans
|
return ans
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ func (self *Command) SuggestionsForCommand(name string, max_distance int /* good
|
|||||||
func (self *Command) SuggestionsForOption(name_with_hyphens string, max_distance int /* good default is 2 */) []string {
|
func (self *Command) SuggestionsForOption(name_with_hyphens string, max_distance int /* good default is 2 */) []string {
|
||||||
ans := make([]string, 0, 8)
|
ans := make([]string, 0, 8)
|
||||||
q := strings.ToLower(name_with_hyphens)
|
q := strings.ToLower(name_with_hyphens)
|
||||||
self.VisitAllOptions(func(opt *Option) error {
|
_ = self.VisitAllOptions(func(opt *Option) error {
|
||||||
for _, a := range opt.Aliases {
|
for _, a := range opt.Aliases {
|
||||||
as := a.String()
|
as := a.String()
|
||||||
if utils.LevenshteinDistance(as, q, true) <= max_distance {
|
if utils.LevenshteinDistance(as, q, true) <= max_distance {
|
||||||
|
|||||||
@ -88,7 +88,10 @@ func GenerateCompletions(args []string) error {
|
|||||||
re(root)
|
re(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
root.Validate()
|
err = root.Validate()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
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]))
|
||||||
|
|||||||
@ -150,7 +150,7 @@ func is_dir_or_symlink_to_dir(entry os.DirEntry, path string) bool {
|
|||||||
|
|
||||||
func fname_based_completer(prefix, cwd string, is_match func(string) bool) []string {
|
func fname_based_completer(prefix, cwd string, is_match func(string) bool) []string {
|
||||||
ans := make([]string, 0, 1024)
|
ans := make([]string, 0, 1024)
|
||||||
CompleteFiles(prefix, func(entry *FileEntry) {
|
_ = CompleteFiles(prefix, func(entry *FileEntry) {
|
||||||
if entry.IsDir && !entry.IsEmptyDir {
|
if entry.IsDir && !entry.IsEmptyDir {
|
||||||
entries, err := os.ReadDir(entry.Abspath)
|
entries, err := os.ReadDir(entry.Abspath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -287,7 +287,7 @@ func CompleteExecutableFirstArg(completions *Completions, word string, arg_num i
|
|||||||
mg := completions.AddMatchGroup("Executables")
|
mg := completions.AddMatchGroup("Executables")
|
||||||
mg.IsFiles = true
|
mg.IsFiles = true
|
||||||
|
|
||||||
CompleteFiles(word, func(entry *FileEntry) {
|
_ = CompleteFiles(word, func(entry *FileEntry) {
|
||||||
if entry.IsDir && !entry.IsEmptyDir {
|
if entry.IsDir && !entry.IsEmptyDir {
|
||||||
// only allow directories that have sub-dirs or executable files in them
|
// only allow directories that have sub-dirs or executable files in them
|
||||||
entries, err := os.ReadDir(entry.Abspath)
|
entries, err := os.ReadDir(entry.Abspath)
|
||||||
@ -324,7 +324,7 @@ func DirectoryCompleter(title string, relative_to relative_to) CompletionFunc {
|
|||||||
mg := completions.AddMatchGroup(title)
|
mg := completions.AddMatchGroup(title)
|
||||||
mg.NoTrailingSpace = true
|
mg.NoTrailingSpace = true
|
||||||
mg.IsFiles = true
|
mg.IsFiles = true
|
||||||
CompleteFiles(word, func(entry *FileEntry) {
|
_ = CompleteFiles(word, func(entry *FileEntry) {
|
||||||
if entry.Mode.IsDir() {
|
if entry.Mode.IsDir() {
|
||||||
mg.AddMatch(entry.CompletionCandidate)
|
mg.AddMatch(entry.CompletionCandidate)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user