From b60f3575274133ad52ed2db584c2d22a7cf51b29 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 17 Jul 2019 17:55:38 -0600 Subject: [PATCH] Added abort() --- scripts/wk/std.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/wk/std.py b/scripts/wk/std.py index 4c786149..64a1c492 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -30,6 +30,16 @@ LOG = logging.getLogger(__name__) # Functions +def abort(prompt='Aborted.', show_prompt=True, return_code=1): + """Abort script.""" + print_warning(prompt) + LOG.warning(prompt) + if show_prompt: + sleep(1) + pause(prompt='Press Enter to exit... ') + sys.exit(return_code) + + def ask(prompt='Kotaero!'): """Prompt the user with a Y/N question, returns bool.""" answer = None