Allow controlling where on the remote computer the ssh kitten installs its data

This commit is contained in:
Kovid Goyal
2022-02-27 13:06:36 +05:30
parent 12658c4756
commit 59f656e3ca
5 changed files with 81 additions and 51 deletions

View File

@@ -27,10 +27,13 @@ to SSH to connect to it.
'''
)
opt('+env', '',
option_type='env',
add_to_default=False,
long_text='''
opt('remote_dir', '.local/share/kitty-ssh-kitten', long_text='''
The location on the remote computer where the files needed for this kitten
are installed. The location is relative to the HOME directory.
'''
)
opt('+env', '', option_type='env', add_to_default=False, long_text='''
Specify environment variables to set on the remote host. Note that
environment variables can refer to each other, so if you use::
@@ -41,8 +44,5 @@ The value of MYVAR2 will be :code:`a/<path to home directory>/b`. Using
:code:`VAR=` will set it to the empty string and using just :code:`VAR`
will delete the variable from the child process' environment. The definitions
are processed alphabetically.
'''
)
''')
egr() # }}}

View File

@@ -14,6 +14,9 @@ class Parser:
def hostname(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
hostname(val, ans)
def remote_dir(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['remote_dir'] = str(val)
def create_result_dict() -> typing.Dict[str, typing.Any]:
return {

View File

@@ -4,11 +4,12 @@ import typing
option_names = ( # {{{
'env', 'hostname') # }}}
'env', 'hostname', 'remote_dir') # }}}
class Options:
hostname: str = '*'
remote_dir: str = '.local/share/kitty-ssh-kitten'
env: typing.Dict[str, str] = {}
config_paths: typing.Tuple[str, ...] = ()
config_overrides: typing.Tuple[str, ...] = ()