From 1f36d10ea7b9704e5e06644b48b42124dd6da2d0 Mon Sep 17 00:00:00 2001 From: Joey Territo Date: Sun, 30 Jan 2022 11:40:22 -0500 Subject: [PATCH] Add option to supply quote at command line --- src/quote.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/quote.py b/src/quote.py index 82f94bf..befb439 100644 --- a/src/quote.py +++ b/src/quote.py @@ -57,6 +57,7 @@ def print_usage(): print("Usage:") print("\t-a quote \t: Adds a quote to the quotes list") print("\t-h \t\t: Prints usage message") + print("\t-q quote \t: Print this quote") print("\t-- : name of a file (excluding extension) in " "the \"asciiArt\" directory to use for the ASCII image") @@ -91,6 +92,12 @@ def main(): add_quote() else: print("You forgot to enter a quote.") + elif sys.argv[1].lower() == '-q': + if len(sys.argv) > 2: + quote = ' '.join(sys.argv[2:]) + print_message(quote) + else: + print('You forgot to enter a quote.') elif sys.argv[1][:2] == "--": quotes = module.input_file(INPUT_FILE) print_message(quotes[random.randint(0,(len(quotes) -1))], ascii_file=sys.argv[1][2:]+'.txt')