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

@@ -6,8 +6,8 @@ import os
import re
import sys
from typing import (
Any, Callable, Container, Dict, Iterable, Iterator, List, NamedTuple,
Optional, Sequence, Tuple, Union
Any, Callable, Container, Dict, FrozenSet, Iterable, Iterator, List,
NamedTuple, Optional, Sequence, Tuple, Union
)
import kitty.fast_data_types as defines
@@ -766,13 +766,13 @@ 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())
def shell_integration(x: str) -> FrozenSet[str]:
s = frozenset({'enabled', 'disabled', 'no-rc', 'no-cursor', 'no-title', 'no-prompt-mark', 'no-complete'})
q = frozenset(x.lower().split())
if not q.issubset(s):
log_error(f'Invalid shell integration options: {q - s}, ignoring')
return ' '.join(q & s)
return x
return q & s
return q
def action_alias(val: str) -> Iterable[Tuple[str, str]]: