Fix getting connection data from ssh command line when -- is used in the command line

This broke the remote file kitten when using the ssh kitten as the later
was changed to use -- recently.

Fixes #3929
This commit is contained in:
Kovid Goyal 2021-08-13 17:14:43 +05:30
parent 97a9261096
commit f3333ce941
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Add :opt:`clear_all_mouse_actions` to clear all mouse actions defined to
that point (:iss:`3907`)
- Fix the remote file kitten not working when using -- with ssh. The ssh kitten
was recently changed to do this (:iss:`3929`)
0.22.2 [2021-08-02]
----------------------

View File

@ -146,15 +146,20 @@ def get_connection_data(args: List[str]) -> Optional[SSHConnectionData]:
port: Optional[int] = None
expecting_port = False
expecting_option_val = False
expecting_hostname = False
for i, arg in enumerate(args):
if not found_ssh:
if os.path.basename(arg).lower() in ('ssh', 'ssh.exe'):
found_ssh = arg
continue
if expecting_hostname:
return SSHConnectionData(found_ssh, arg, port)
if arg.startswith('-') and not expecting_option_val:
if arg in boolean_ssh_args:
continue
if arg == '--':
expecting_hostname = True
if arg.startswith('-p'):
if arg[2:].isdigit():
with suppress(Exception):