Make askpass a choice var

This commit is contained in:
Kovid Goyal
2022-03-15 13:14:53 +05:30
parent 868d57b818
commit 7168ceab94
3 changed files with 14 additions and 5 deletions

View File

@@ -8,7 +8,12 @@ from kitty.conf.utils import merge_dicts, to_bool
class Parser:
def askpass(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['askpass'] = str(val)
val = val.lower()
if val not in self.choices_for_askpass:
raise ValueError(f"The value {val} is not a valid choice for askpass")
ans["askpass"] = val
choices_for_askpass = frozenset(('unless-set', 'ssh', 'native'))
def copy(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
for k, v in copy(val, ans["copy"]):