mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 22:14:53 +02:00
Delegate based completion for kitty cmd
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user