diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..25ec5e76 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,29 @@ +import cowsay +import argparse + +parser = argparse.ArgumentParser( + prog="cowsay", + description="Make animals say things", +) + +valid_animal = cowsay.char_names + +parser.add_argument( + "--animal", + choices=valid_animal, + default="cow", + help=" The animal to be saying things." +) +parser.add_argument( + "message", + nargs="+", + help="The message to say" +) + +args = parser.parse_args() + +# to compose full msg +message = " ".join(args.message) + +# Call selected cowsay func +getattr(cowsay, args.animal)(message) diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 00000000..c6b9ffd0 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay