Completion: Handle kitty +complete setup fish2

Provide the currently supported fish completion script when requesting
version 2.
This commit is contained in:
pagedown 2023-02-04 15:55:22 +08:00
parent 9bdb647454
commit 52b643b6c6
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB

View File

@ -37,6 +37,8 @@ def complete(args: List[str]) -> None:
raise SystemExit(1)
if args[1] == 'fish2':
args[1:1] = ['fish', '_legacy_completion=fish2']
elif len(args) >= 3 and args [1:3] == ['setup', 'fish2']:
args[2] = 'fish'
from kitty.constants import kitten_exe
args = ['kitten', '__complete__'] + args[1:]
os.execvp(kitten_exe(), args)