mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-08-16 10:00:24 +03:00
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 {
|
||||
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
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
ans := make([]string, 0, 8)
|
||||
q := strings.ToLower(name_with_hyphens)
|
||||
self.VisitAllOptions(func(opt *Option) error {
|
||||
_ = self.VisitAllOptions(func(opt *Option) error {
|
||||
for _, a := range opt.Aliases {
|
||||
as := a.String()
|
||||
if utils.LevenshteinDistance(as, q, true) <= max_distance {
|
||||
|
@ -88,7 +88,10 @@ func GenerateCompletions(args []string) error {
|
||||
re(root)
|
||||
}
|
||||
|
||||
root.Validate()
|
||||
err = root.Validate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
all_completions := make([]*Completions, 0, 1)
|
||||
for _, argv := range all_argv {
|
||||
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 {
|
||||
ans := make([]string, 0, 1024)
|
||||
CompleteFiles(prefix, func(entry *FileEntry) {
|
||||
_ = CompleteFiles(prefix, func(entry *FileEntry) {
|
||||
if entry.IsDir && !entry.IsEmptyDir {
|
||||
entries, err := os.ReadDir(entry.Abspath)
|
||||
if err == nil {
|
||||
@ -287,7 +287,7 @@ func CompleteExecutableFirstArg(completions *Completions, word string, arg_num i
|
||||
mg := completions.AddMatchGroup("Executables")
|
||||
mg.IsFiles = true
|
||||
|
||||
CompleteFiles(word, func(entry *FileEntry) {
|
||||
_ = CompleteFiles(word, func(entry *FileEntry) {
|
||||
if entry.IsDir && !entry.IsEmptyDir {
|
||||
// only allow directories that have sub-dirs or executable files in them
|
||||
entries, err := os.ReadDir(entry.Abspath)
|
||||
@ -324,7 +324,7 @@ func DirectoryCompleter(title string, relative_to relative_to) CompletionFunc {
|
||||
mg := completions.AddMatchGroup(title)
|
||||
mg.NoTrailingSpace = true
|
||||
mg.IsFiles = true
|
||||
CompleteFiles(word, func(entry *FileEntry) {
|
||||
_ = CompleteFiles(word, func(entry *FileEntry) {
|
||||
if entry.Mode.IsDir() {
|
||||
mg.AddMatch(entry.CompletionCandidate)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user