summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine A <>2024-02-24 19:06:42 +0100
committerAntoine A <>2024-02-24 19:06:42 +0100
commitcd70aaeaf604f5fda3a38686693430d4c0a7718d (patch)
tree5219fcd498647f2b83e113f51e009f6ef419cded
parentb88b78e626083d1495b90441d0cdf7dd4c2afc32 (diff)
downloaddeployment-cd70aaeaf604f5fda3a38686693430d4c0a7718d.tar.gz
deployment-cd70aaeaf604f5fda3a38686693430d4c0a7718d.tar.bz2
deployment-cd70aaeaf604f5fda3a38686693430d4c0a7718d.zip
fmt python
-rwxr-xr-xregional-currency/ask_questions.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/regional-currency/ask_questions.py b/regional-currency/ask_questions.py
index c8da3b1..200f779 100755
--- a/regional-currency/ask_questions.py
+++ b/regional-currency/ask_questions.py
@@ -83,7 +83,7 @@ def conf_value(
:return: the configuration value
"""
value = None
-
+
# Fetch current value
if name is not None:
curr = conf.get(name, None)
@@ -96,12 +96,11 @@ def conf_value(
new = action()
# Use default if no value was provided else check the new value
value = check(new) if new is not None else default
-
-
+
# Store the new value
if name is not None:
add_conf(name, fmt(value))
-
+
return value
@@ -121,6 +120,7 @@ def ask(
:param fmt: format value for storage
:return: the configuration value
"""
+
def do_ask() -> str | None:
# Log the prompt
log.write(msg.encode() + "\n".encode())
@@ -142,6 +142,7 @@ def ask_str(name: str | None, msg: str, default: str | None = None) -> str:
def ask_currency(name: str, msg: str, default: str | None = None) -> str:
"Prompt the user to configure a currency name"
+
def check_currency(currency: str) -> str | None:
currency = currency.upper()
if not currency.isascii() or not currency.isalpha():
@@ -157,6 +158,7 @@ def ask_currency(name: str, msg: str, default: str | None = None) -> str:
def ask_host(name: str, msg: str, default: str | None = None) -> str:
"Prompt the user to configure the installation hostname"
+
def check_host(host: str) -> str | None:
success = True
for subdomain in ["backend", "bank", "exchange"]:
@@ -171,6 +173,7 @@ def ask_host(name: str, msg: str, default: str | None = None) -> str:
def ask_yes_no(name: str | None, msg: str, default: bool | None = None) -> bool:
"Prompt the user to configure a boolean"
+
def check_yes_no(raw: str) -> bool | None:
raw = raw.lower()
if raw == "y" or raw == "yes":