3 Commits

Author SHA1 Message Date
  Jeffery Russell 2edfeb945e
Merge pull request #45 from jtt9340/master 2 years ago
  Joey Territo 1f36d10ea7 Add option to supply quote at command line 2 years ago
  Joey Territo 400e59beae Add undocumented command line flag to usage message 2 years ago
1 changed files with 9 additions and 0 deletions
Split View
  1. +9
    -0
      src/quote.py

+ 9
- 0
src/quote.py View File

@ -57,6 +57,9 @@ 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--<ASCII image to use> : name of a file (excluding extension) in "
"the \"asciiArt\" directory to use for the ASCII image")
def add_quote():
@ -89,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')

Loading…
Cancel
Save