add verification for parsing shell_integration

This commit is contained in:
Kovid Goyal
2021-11-29 12:04:19 +05:30
parent c7bf54807e
commit 6b38ca3bd2
3 changed files with 13 additions and 4 deletions

View File

@@ -766,6 +766,15 @@ def watcher(val: str, current_val: Container[str]) -> Iterable[Tuple[str, str]]:
yield val, val
def shell_integration(x: str) -> str:
s = {'enabled', 'disabled', 'no-rc', 'no-cursor', 'no-title', 'no-prompt-mark', 'no-complete'}
q = set(x.split())
if not q.issubset(s):
log_error(f'Invalid shell integration options: {q - s}, ignoring')
return ' '.join(q & s)
return x
def action_alias(val: str) -> Iterable[Tuple[str, str]]:
parts = val.split(maxsplit=1)
if len(parts) > 1: