1
0
mirror of https://github.com/vikstrous/pirate-get synced 2025-01-10 10:04:21 +01:00

Added 'q' to quit script

This commit is contained in:
ReShun Davis 2014-10-28 23:26:37 -07:00
parent cb9ed18e9d
commit 2602b1bab9

View File

@ -338,15 +338,15 @@ def main():
# New input loop to support different link options # New input loop to support different link options
while True: while True:
try: 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 : except KeyboardInterrupt :
print("\nCancelled.") print("\nCancelled.")
exit() exit()
try: try:
# Very permissive handling # Very permissive handling
# Check for any occurances or d, f, or p # Check for any occurances or d, f, p or q
cmd_code_match = re.search(r'([hdfp])', l, flags=re.IGNORECASE) cmd_code_match = re.search(r'([hdfpq])', l, flags=re.IGNORECASE)
if cmd_code_match: if cmd_code_match:
code = cmd_code_match.group(0).lower() code = cmd_code_match.group(0).lower()
else: else:
@ -366,7 +366,11 @@ def main():
print("[d<links>]: Get descriptions") print("[d<links>]: Get descriptions")
print("[f<links>]: Get files") print("[f<links>]: Get files")
print("[p] Print search results") print("[p] Print search results")
print("[q] Quit")
continue continue
elif code == 'q':
print("User Cancelled.")
exit()
elif code == 'd': elif code == 'd':
print_descriptions(choices) print_descriptions(choices)
continue continue