From e4367180c67085611b995e1539f0995be05d0308 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:50:10 +0000 Subject: Add prompt for install --- deploy.py | 4 ++++ util/prompt.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 util/prompt.py diff --git a/deploy.py b/deploy.py index 5d0b0a2..75bbabf 100755 --- a/deploy.py +++ b/deploy.py @@ -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) -- cgit v1.2.3-70-g09d2