From 9677083fc48f2b04ba5af96dae32483140728f17 Mon Sep 17 00:00:00 2001 From: Priscilla Date: Wed, 13 Aug 2025 08:35:11 +0100 Subject: [PATCH] cowsay implementation --- implement-cowsay/cow.py | 22 ++++++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 2 files changed, 23 insertions(+) create mode 100644 implement-cowsay/cow.py create mode 100644 implement-cowsay/requirements.txt diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..beecfa68 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,22 @@ +import argparse +import cowsay + +def main(): + supported_animals = cowsay.char_names + + parser = argparse.ArgumentParser(description="Make an animal say something") + parser.add_argument("message", nargs="+", help="The message to say") + parser.add_argument("--animal", choices=supported_animals, default="cow", + help="The animal to be saying things") + + args = parser.parse_args() + + message_text = " ".join(args.message) + + say_function = getattr(cowsay, args.animal) + say_function(message_text) + +if __name__ == "__main__": + main() + + 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