diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 000000000..5da23c518 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,32 @@ +import argparse +import cowsay +import sys + +def main(): + available_animals = sorted(cowsay.char_names) + + parser = argparse.ArgumentParser( + prog = "cowsay", + description = "Make animals say things" + ) + + parser.add_argument( + "--animal", + choices=available_animals, + default="cow", + help="The animal to be saying things." + ) + parser.add_argument( + "message", + nargs="+", + help="The message to say." + ) + + args = parser.parse_args() + + full_message = " ".join(args.message) + + print(cowsay.get_output_string(args.animal, full_message)) + +if __name__ == "__main__": + main()