diff --git a/.gitignore b/.gitignore index c4234ab7..c4a1c53c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules +.venv +*.class testoutput.txt diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..f7c647e2 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,21 @@ +import argparse +import cowsay + +available_animals = cowsay.CHARS + +parser = argparse.ArgumentParser(prog="cowsay") +parser.add_argument("message", nargs="+", help="What the animal will say") +parser.add_argument( + "--animal", + choices=available_animals.keys(), + default="cow", + help="The animal that will say the word", +) + +args = parser.parse_args() + +message_joined = " ".join(args.message) + +animal = args.animal + +getattr(cowsay, animal)(message_joined) 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