Delegate based completion for kitty cmd

This commit is contained in:
Kovid Goyal
2022-09-19 12:17:53 +05:30
parent 2cc359ccc8
commit dc403156a9
5 changed files with 42 additions and 2 deletions

View File

@@ -52,6 +52,19 @@ def all_words(*words):
return t
def is_delegate(num_to_remove: int = 0, command: str = ''):
q = {}
if num_to_remove:
q['num_to_remove'] = num_to_remove
if command:
q['command'] = command
def t(self, result):
d = result['delegate']
self.assertEqual(d, q)
return t
def completion(self: TestCompletion, tdir: str):
all_cmds = []
all_argv = []
@@ -148,6 +161,10 @@ def completion(self: TestCompletion, tdir: str):
make_file('editable.txt')
add('edit-in-kitty ', has_words('editable.txt'))
add('kitty bash ', is_delegate(1, 'bash'))
add('kitty -1 bash ', is_delegate(2, 'bash'))
add('kitty -1 bash --n', is_delegate(2, 'bash'))
for cmd, tests, result in zip(all_cmds, all_tests, run_tool()):
self.current_cmd = cmd
for test in tests: