better fix for file completion in Go
When neither extensions for mime are specified assume we want to match all files.
This commit is contained in:
parent
8e98b4123e
commit
5066623089
@ -75,11 +75,16 @@ class CompletionSpec:
|
|||||||
relative_to = 'CONFIG' if self.relative_to is CompletionRelativeTo.config_dir else 'CWD'
|
relative_to = 'CONFIG' if self.relative_to is CompletionRelativeTo.config_dir else 'CWD'
|
||||||
if self.type is CompletionType.file:
|
if self.type is CompletionType.file:
|
||||||
g = serialize_as_go_string(self.group or 'Files')
|
g = serialize_as_go_string(self.group or 'Files')
|
||||||
|
added = False
|
||||||
if self.extensions:
|
if self.extensions:
|
||||||
|
added = True
|
||||||
pats = (f'"*.{ext}"' for ext in self.extensions)
|
pats = (f'"*.{ext}"' for ext in self.extensions)
|
||||||
completers.append(f'cli.FnmatchCompleter("{g}", cli.{relative_to}, ' + ', '.join(pats) + ')')
|
completers.append(f'cli.FnmatchCompleter("{g}", cli.{relative_to}, ' + ', '.join(pats) + ')')
|
||||||
if self.mime_patterns:
|
if self.mime_patterns:
|
||||||
|
added = True
|
||||||
completers.append(f'cli.MimepatCompleter("{g}", cli.{relative_to}, ' + ', '.join(f'"{p}"' for p in self.mime_patterns) + ')')
|
completers.append(f'cli.MimepatCompleter("{g}", cli.{relative_to}, ' + ', '.join(f'"{p}"' for p in self.mime_patterns) + ')')
|
||||||
|
if not added:
|
||||||
|
completers.append(f'cli.FnmatchCompleter("{g}", cli.{relative_to}, "*")')
|
||||||
if self.type is CompletionType.directory:
|
if self.type is CompletionType.directory:
|
||||||
g = serialize_as_go_string(self.group or 'Directories')
|
g = serialize_as_go_string(self.group or 'Directories')
|
||||||
completers.append(f'cli.DirectoryCompleter("{g}", cli.{relative_to})')
|
completers.append(f'cli.DirectoryCompleter("{g}", cli.{relative_to})')
|
||||||
|
|||||||
@ -253,7 +253,7 @@ accepted before or is pre-configured in :file:`kitty.conf`.
|
|||||||
|
|
||||||
|
|
||||||
--password-file
|
--password-file
|
||||||
completion=type:file mime:* relative:conf kwds:-
|
completion=type:file relative:conf kwds:-
|
||||||
default=rc-pass
|
default=rc-pass
|
||||||
A file from which to read the password. Trailing whitespace is ignored. Relative
|
A file from which to read the password. Trailing whitespace is ignored. Relative
|
||||||
paths are resolved from the kitty configuration directory. Use - to read from STDIN.
|
paths are resolved from the kitty configuration directory. Use - to read from STDIN.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user