mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 06:25:13 +02:00
Add an option to control the login shell
This commit is contained in:
@@ -96,6 +96,8 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str]) -> bytes:
|
||||
env.update(ssh_opts.env)
|
||||
env['KITTY_SHELL_INTEGRATION'] = ksi or DELETE_ENV_VAR
|
||||
env['KITTY_SSH_KITTEN_DATA_DIR'] = ssh_opts.remote_dir
|
||||
if ssh_opts.login_shell:
|
||||
env['KITTY_LOGIN_SHELL'] = ssh_opts.login_shell
|
||||
env_script = serialize_env(env, base_env)
|
||||
buf = io.BytesIO()
|
||||
with tarfile.open(mode='w:bz2', fileobj=buf, encoding='utf-8') as tf:
|
||||
@@ -173,7 +175,7 @@ def prepare_script(ans: str, replacements: Dict[str, str]) -> str:
|
||||
atexit.register(safe_remove, tf.name)
|
||||
replacements['DATA_PASSWORD'] = pw
|
||||
replacements['PASSWORD_FILENAME'] = os.path.basename(tf.name)
|
||||
for k in ('EXEC_CMD', 'OVERRIDE_LOGIN_SHELL'):
|
||||
for k in ('EXEC_CMD',):
|
||||
replacements[k] = replacements.get(k, '')
|
||||
|
||||
def sub(m: 're.Match[str]') -> str:
|
||||
|
||||
@@ -91,5 +91,8 @@ for details on how this setting works. The special value :code:`inherit` means
|
||||
use the setting from kitty.conf. This setting is useful for overriding
|
||||
integration on a per-host basis.''')
|
||||
|
||||
opt('login_shell', '', long_text='''
|
||||
The login shell to execute on the remote host. By default, the remote user account's
|
||||
login shell is used.''')
|
||||
|
||||
egr() # }}}
|
||||
|
||||
@@ -21,6 +21,9 @@ class Parser:
|
||||
def interpreter(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['interpreter'] = str(val)
|
||||
|
||||
def login_shell(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['login_shell'] = str(val)
|
||||
|
||||
def remote_dir(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['remote_dir'] = relative_dir(val)
|
||||
|
||||
|
||||
@@ -5,12 +5,19 @@ import kittens.ssh.copy
|
||||
|
||||
|
||||
option_names = ( # {{{
|
||||
'copy', 'env', 'hostname', 'interpreter', 'remote_dir', 'shell_integration') # }}}
|
||||
'copy',
|
||||
'env',
|
||||
'hostname',
|
||||
'interpreter',
|
||||
'login_shell',
|
||||
'remote_dir',
|
||||
'shell_integration') # }}}
|
||||
|
||||
|
||||
class Options:
|
||||
hostname: str = '*'
|
||||
interpreter: str = 'sh'
|
||||
login_shell: str = ''
|
||||
remote_dir: str = '.local/share/kitty-ssh-kitten'
|
||||
shell_integration: str = 'inherit'
|
||||
copy: typing.Dict[str, kittens.ssh.copy.CopyInstruction] = {}
|
||||
|
||||
Reference in New Issue
Block a user