diff options
| author | 2026-06-08 16:53:18 +0100 | |
|---|---|---|
| committer | 2026-06-08 16:53:18 +0100 | |
| commit | 21eb9025affc1e9d81604a8633a6955f8a0caddb (patch) | |
| tree | 1aa1bcb299577569abe4380888d3d968e9ecc0eb /src/python | |
| parent | Default to the current state in `modulemanager extra interactive`. (diff) | |
Use red/green for boolean prompts like in v4.
Diffstat (limited to 'src/python')
| -rw-r--r-- | src/python/console.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/python/console.py b/src/python/console.py index dc5c30a46..81ea37eff 100644 --- a/src/python/console.py +++ b/src/python/console.py @@ -62,7 +62,10 @@ def interactive(): # Prompts for the user to enter a boolean value. def prompt_boolean(default): while True: - answer = prompt_string("yes" if default else "no").lower() + if default: + answer = prompt_string("yes", BOLD_GREEN).lower() + else: + answer = prompt_string("no", BOLD_RED).lower() if answer in ("y", "yes"): return True if answer in ("n", "no"): @@ -71,8 +74,8 @@ def prompt_boolean(default): # Prompts for the user to enter a string value. -def prompt_string(default): - answer = input(f"[{color(default, BOLD)}] => ").strip() +def prompt_string(default, style=BOLD): + answer = input(f"[{color(default, style)}] => ").strip() print() return answer if answer else default |
