From 47c12ad0ccbfe34f0a01a58a62114054e6e793ea Mon Sep 17 00:00:00 2001 From: mervereis Date: Sun, 2 Aug 2026 22:05:29 +0100 Subject: [PATCH] Implement cowsay functionality with command-line interface --- implement-cowsay/cow.py | 32 +++++++++++++++++++++++++++++++ implement-cowsay/requirements.txt | 2 ++ 2 files changed, 34 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 000000000..779d578bd --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,32 @@ + +import argparse +import cowsay + +def main(): + 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( + "message", + nargs="+", + help="The message to say." + ) + + args = parser.parse_args() + + message = " ".join(args.message) + + print(cowsay.get_output_string(args.animal, message)) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 000000000..00e2cfc5e --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1,2 @@ +cowsay +argparse \ No newline at end of file