Add config to control shell integration per host
This commit is contained in:
parent
59f656e3ca
commit
c6f37afeff
@ -17,7 +17,6 @@ from typing import (
|
||||
)
|
||||
|
||||
from kitty.constants import cache_dir, shell_integration_dir, terminfo_dir
|
||||
from kitty.shell_integration import get_effective_ksi_env_var
|
||||
from kitty.short_uuid import uuid4
|
||||
from kitty.types import run_once
|
||||
from kitty.utils import SSHConnectionData
|
||||
@ -52,7 +51,13 @@ def make_tarfile(ssh_opts: SSHOptions) -> bytes:
|
||||
buf = io.BytesIO()
|
||||
with tarfile.open(mode='w:bz2', fileobj=buf, encoding='utf-8') as tf:
|
||||
rd = ssh_opts.remote_dir.rstrip('/')
|
||||
ksi = get_effective_ksi_env_var()
|
||||
from kitty.shell_integration import get_effective_ksi_env_var
|
||||
if ssh_opts.shell_integration == 'inherit':
|
||||
ksi = get_effective_ksi_env_var()
|
||||
else:
|
||||
from kitty.options.types import Options
|
||||
from kitty.options.utils import shell_integration
|
||||
ksi = get_effective_ksi_env_var(Options({'shell_integration': shell_integration(ssh_opts.shell_integration)}))
|
||||
if ksi:
|
||||
tf.add(shell_integration_dir, arcname=rd + '/shell-integration', filter=filter_files)
|
||||
add_data_as_file(tf, rd + '/settings/ksi_env_var', ksi)
|
||||
|
||||
@ -24,14 +24,18 @@ hosts can be used. When not specified options apply to all hosts, until the
|
||||
first hostname specification is found. Note that the hostname this matches
|
||||
against is the hostname used by the remote computer, not the name you pass
|
||||
to SSH to connect to it.
|
||||
'''
|
||||
)
|
||||
''')
|
||||
|
||||
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('shell_integration', 'inherit', long_text='''
|
||||
Control the shell integration on the remote host. See ref:`shell_integration`
|
||||
for details on how this setting works. The special value :code:`inherit` means
|
||||
use the setting from kitty.conf. This setting is mainly useful for overriding
|
||||
integration on a per-host basis.''')
|
||||
|
||||
opt('+env', '', option_type='env', add_to_default=False, long_text='''
|
||||
Specify environment variables to set on the remote host. Note that
|
||||
|
||||
@ -17,6 +17,9 @@ class Parser:
|
||||
def remote_dir(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['remote_dir'] = str(val)
|
||||
|
||||
def shell_integration(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['shell_integration'] = str(val)
|
||||
|
||||
|
||||
def create_result_dict() -> typing.Dict[str, typing.Any]:
|
||||
return {
|
||||
|
||||
@ -4,12 +4,13 @@ import typing
|
||||
|
||||
|
||||
option_names = ( # {{{
|
||||
'env', 'hostname', 'remote_dir') # }}}
|
||||
'env', 'hostname', 'remote_dir', 'shell_integration') # }}}
|
||||
|
||||
|
||||
class Options:
|
||||
hostname: str = '*'
|
||||
remote_dir: str = '.local/share/kitty-ssh-kitten'
|
||||
shell_integration: str = 'inherit'
|
||||
env: typing.Dict[str, str] = {}
|
||||
config_paths: typing.Tuple[str, ...] = ()
|
||||
config_overrides: typing.Tuple[str, ...] = ()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user