diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2022-11-20 22:50:10 +0000 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2022-11-20 22:50:10 +0000 |
| commit | e4367180c67085611b995e1539f0995be05d0308 (patch) | |
| tree | c88654b9358a8d69db1e82b7ca9df220a26f497e | |
| parent | 19c90d94c998036c3df0575105dc29fed0bb4313 (diff) | |
Add prompt for install
| -rwxr-xr-x | deploy.py | 4 | ||||
| -rw-r--r-- | util/prompt.py | 12 |
2 files changed, 16 insertions, 0 deletions
@@ -4,6 +4,7 @@ import os from util.runners import run_step from util.exceptions import StepFailedError from util.helpers import check_preconditions +from util.prompt import query_yes_no import yaml from termcolor import colored @@ -46,6 +47,9 @@ print("Sections to run: " + ", ".join( )) print() +if not query_yes_no("Proceed with install?", False): + exit(1) + section_count = 0 total = len(sections.keys()) notes = {} diff --git a/util/prompt.py b/util/prompt.py new file mode 100644 index 0000000..d6eb17b --- /dev/null +++ b/util/prompt.py @@ -0,0 +1,12 @@ +import sys + + +def query_yes_no(question, default): + if default == True: + prompt = " [Y/n] " + else: + prompt = " [y/N] " + + sys.stdout.write(question + prompt) + choice = input().lower() + return True if choice == "y" else (False if choice == "n" else default) |
