diff --git a/.gitignore b/.gitignore index 3c3629e6..274d0491 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +.venv \ No newline at end of file diff --git a/implement-cowsay/cowsay_script.py b/implement-cowsay/cowsay_script.py new file mode 100644 index 00000000..bcf75a9b --- /dev/null +++ b/implement-cowsay/cowsay_script.py @@ -0,0 +1,38 @@ +import argparse +import cowsay +import sys + +parser = argparse.ArgumentParser( + prog="cowsay", + description="Make animals say things" +) + +parser.add_argument( + "--animal", + choices=cowsay.char_names, + default="cow", + help="The animal to be saying things." +) + +parser.add_argument( + "--list-animals", + action="store_true", + help="List available animals and exit." +) + +parser.add_argument( + "message", + nargs="*", + help="The message for the animal to say." +) + +args = parser.parse_args() + +if args.list_animals: + print("\n".join(cowsay.char_names)) + sys.exit(0) + +if not args.message: + parser.error("the following arguments are required: message") + +getattr(cowsay, args.animal)(" ".join(args.message)) 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