Store the shell_integration option as a set

This commit is contained in:
Kovid Goyal
2021-11-29 12:41:25 +05:30
parent 9441cf15c3
commit c8c6f8691f
4 changed files with 12 additions and 15 deletions

View File

@@ -108,10 +108,7 @@ def get_supported_shell_name(path: str) -> Optional[str]:
def shell_integration_allows_rc_modification(opts: Options) -> bool:
q = set(opts.shell_integration.split())
if q & {'disabled', 'no-rc'}:
return False
return True
return not bool(opts.shell_integration & {'disabled', 'no-rc'})
def setup_shell_integration(opts: Options, env: Dict[str, str]) -> bool:
@@ -133,9 +130,9 @@ def setup_shell_integration(opts: Options, env: Dict[str, str]) -> bool:
def modify_shell_environ(argv0: str, opts: Options, env: Dict[str, str]) -> None:
shell = get_supported_shell_name(argv0)
if shell is None or 'disabled' in set(opts.shell_integration.split()):
if shell is None or 'disabled' in opts.shell_integration:
return
env['KITTY_SHELL_INTEGRATION'] = opts.shell_integration
env['KITTY_SHELL_INTEGRATION'] = ' '.join(opts.shell_integration)
if not shell_integration_allows_rc_modification(opts):
return
f = ENV_MODIFIERS.get(shell)