diff --git a/.gitignore b/.gitignore index 3c3629e6..da79f901 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +**/.venv diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..e5345cba --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,26 @@ +import cowsay +import argparse + +def main(): + # Get dynamic list of animals from the cowsay library + animals = cowsay.char_names + + parser = argparse.ArgumentParser( + prog="cowsay", + description="Make animals say things" + ) + + parser.add_argument("--animal", choices=animals, default="cow",help="The animal to be saying things.") + parser.add_argument("message", nargs="+", help="The message to say.") + + args = parser.parse_args() + + # Join all message words into a single string + message = " ".join(args.message) + + # Output the message using the selected animal or the default cow + cowsay.char_funcs[args.animal](message) + + +if __name__ == "__main__": + main() diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 00000000..cc557103 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay \ No newline at end of file