Add new settings

This commit is contained in:
2024-03-08 22:38:18 +08:00
parent ccb19875ca
commit c0568543a5
5 changed files with 43 additions and 1 deletions

View File

@@ -53,3 +53,13 @@ def ask_choice(cfg: Config, choices: list, prompt='请选择:', fn=None, extra
if index < 0 or index >= count:
continue
return choices[index]
def parse_bool(s: str):
if s.lower() in ['y', 'yes', 'true', 't']:
return True
if s.lower() in ['n', 'no', 'false', 'f']:
return False
if s.isnumeric():
return bool(int(s))
raise ValueError(f"Unexpected bool value: {s}")