From e205a3d623bf3182835adb51b858c157cfd30a3e Mon Sep 17 00:00:00 2001 From: Zobeir-Rigi Date: Tue, 19 May 2026 01:07:16 +0100 Subject: [PATCH] Implement cowsay CLI tool --- implement-cowsay/.gitignore | 5 +++++ implement-cowsay/cow.py | 35 +++++++++++++++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 3 files changed, 41 insertions(+) create mode 100644 implement-cowsay/.gitignore create mode 100644 implement-cowsay/cow.py create mode 100644 implement-cowsay/requirements.txt diff --git a/implement-cowsay/.gitignore b/implement-cowsay/.gitignore new file mode 100644 index 000000000..0d4602d84 --- /dev/null +++ b/implement-cowsay/.gitignore @@ -0,0 +1,5 @@ +.venv/ +venv/ +__pycache__/ +*.pyc +.DS_Store \ No newline at end of file diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 000000000..06beb97e4 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,35 @@ +import argparse +import cowsay + + +def main(): + # Get animals dynamically from cowsay (DO NOT hardcode) + animals = 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() + + 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..c6b9ffd0e --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay