-
-
Notifications
You must be signed in to change notification settings - Fork 42
Manchester | 25-SDC-Nov | Rahwa Haile | Sprint 4 | Implement cowsay in Python #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| node_modules | ||
| .venv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/usr/bin/env python3 | ||
| import argparse | ||
| import cowsay | ||
| import sys | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser( | ||
| description="Make animals say things" | ||
| ) | ||
| parser.add_argument( | ||
| "message", nargs="+", help="The message to say." | ||
| ) | ||
| parser.add_argument( | ||
| "--animal", | ||
| default="cow", | ||
| help="The animal to be saying things." | ||
| ) | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
| text = " ".join(args.message) | ||
| animal = args.animal | ||
|
|
||
| supported_animals = [ | ||
|
||
| "beavis", "cheese", "cow", "daemon", "dragon", "fox", | ||
| "ghostbusters", "kitty", "meow", "miki", "milk", "octopus", | ||
| "pig", "stegosaurus", "stimpy", "trex", "turkey", "turtle", "tux" | ||
| ] | ||
|
|
||
| if animal not in supported_animals: | ||
| print(f"usage: cowsay [-h] [--animal {{{','.join(supported_animals)}}}] message [message ...]") | ||
| print(f"cowsay: error: argument --animal: invalid choice: '{animal}' (choose from {','.join(supported_animals)})") | ||
| sys.exit(1) | ||
|
|
||
| output = cowsay.get_output_string(animal, text) | ||
| print(output) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, you want to exclude the .venv directory. But what about the things you are installing into the .venv. Is there enough comitted here for me to be able to re-create your venv on my machine? which file is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you .I created the requirements.txt