From fd631bf40235d2db48f7730fd0592ef6fab0ae62 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Sep 2022 12:23:45 +0530 Subject: [PATCH] Delegate based completion for @launch args --- kitty/rc/launch.py | 3 ++- kitty_tests/completion.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kitty/rc/launch.py b/kitty/rc/launch.py index 17e98180c..6c14060c5 100644 --- a/kitty/rc/launch.py +++ b/kitty/rc/launch.py @@ -72,7 +72,8 @@ type=bool-set If specified the tab containing the window this command is run in is used instead of the active tab ''' + '\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: ans = {'args': args or []} diff --git a/kitty_tests/completion.py b/kitty_tests/completion.py index 3d32d5a5b..d9dc08c39 100644 --- a/kitty_tests/completion.py +++ b/kitty_tests/completion.py @@ -164,6 +164,8 @@ def completion(self: TestCompletion, tdir: str): add('kitty bash ', is_delegate(1, 'bash')) add('kitty -1 bash ', 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()): self.current_cmd = cmd