From 6b3d4be5800af6398fbe19fb24ebf7921c9d1e5a Mon Sep 17 00:00:00 2001 From: ronnyabraham Date: Sun, 3 Nov 2019 17:44:16 +0200 Subject: [PATCH] updated prompt_continue, so it now gives the option of either exiting on failure or returning a true/false value --- modules/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/utils.py b/modules/utils.py index b1aa820..2f48ffc 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -379,7 +379,8 @@ def link_create(path_src, path_dst, debug=False): return msg_debug -def prompt_continue(message="Do you want to continue? Y/n", default="Y"): +def prompt_continue(message="Do you want to continue? Y/n", default="Y", + exit=True): """ prompts user if he wants to continue Keyword Arguments: @@ -399,9 +400,13 @@ def prompt_continue(message="Do you want to continue? Y/n", default="Y"): printvar( "prompt_val", prompt_val, not booleanize(prompt_val)) + return True else: if not booleanize(prompt_val): - sys.exit() + if exit: + sys.exit() + else: + return False def check_debug(env):