From 2602b1bab95c49aa71f43fb8e424b4f2ce457d92 Mon Sep 17 00:00:00 2001 From: ReShun Davis Date: Tue, 28 Oct 2014 23:26:37 -0700 Subject: [PATCH] Added 'q' to quit script --- pirate-get.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pirate-get.py b/pirate-get.py index 02509a4..8bf7efc 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -338,15 +338,15 @@ def main(): # New input loop to support different link options while True: try: - l = raw_input("Select link(s) (Type 'h' for more options): ") + l = raw_input("Select link(s) (Type 'h' for more options ['q' to quit]): ") except KeyboardInterrupt : print("\nCancelled.") exit() try: # Very permissive handling - # Check for any occurances or d, f, or p - cmd_code_match = re.search(r'([hdfp])', l, flags=re.IGNORECASE) + # Check for any occurances or d, f, p or q + cmd_code_match = re.search(r'([hdfpq])', l, flags=re.IGNORECASE) if cmd_code_match: code = cmd_code_match.group(0).lower() else: @@ -366,7 +366,11 @@ def main(): print("[d]: Get descriptions") print("[f]: Get files") print("[p] Print search results") + print("[q] Quit") continue + elif code == 'q': + print("User Cancelled.") + exit() elif code == 'd': print_descriptions(choices) continue