Delegate based completion for @launch args

This commit is contained in:
Kovid Goyal 2022-09-19 12:23:45 +05:30
parent dc403156a9
commit fd631bf402
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 1 deletions

View File

@ -72,7 +72,8 @@ type=bool-set
If specified the tab containing the window this command is run in is used If specified the tab containing the window this command is run in is used
instead of the active tab instead of the active tab
''' + '\n\n' + launch_options_spec().replace(':option:`launch', ':option:`kitty @ launch') ''' + '\n\n' + launch_options_spec().replace(':option:`launch', ':option:`kitty @ launch')
args = RemoteCommand.Args(spec='[CMD ...]', json_field='args') args = RemoteCommand.Args(spec='[CMD ...]', json_field='args', completion=RemoteCommand.CompletionSpec.from_string(
'type:special group:complete_kitty'))
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
ans = {'args': args or []} ans = {'args': args or []}

View File

@ -164,6 +164,8 @@ def completion(self: TestCompletion, tdir: str):
add('kitty bash ', is_delegate(1, 'bash')) add('kitty bash ', is_delegate(1, 'bash'))
add('kitty -1 bash ', is_delegate(2, 'bash')) add('kitty -1 bash ', is_delegate(2, 'bash'))
add('kitty -1 bash --n', is_delegate(2, 'bash')) add('kitty -1 bash --n', is_delegate(2, 'bash'))
add('kitty @launch --type tab bash --n', is_delegate(4, 'bash'))
add('kitty @launch e', all_words('exe1'))
for cmd, tests, result in zip(all_cmds, all_tests, run_tool()): for cmd, tests, result in zip(all_cmds, all_tests, run_tool()):
self.current_cmd = cmd self.current_cmd = cmd