diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..ecf1f2c9 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,30 @@ + +import argparse +import cowsay + +def main(): + animals = sorted(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() + text = " ".join(args.message) + + getattr(cowsay, args.animal)(text) + +if __name__ == '__main__': + main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..cc557103 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +cowsay \ No newline at end of file