From c54ba92924ab5262854af30fd2a612db8a418d8c Mon Sep 17 00:00:00 2001 From: iswat Date: Sat, 11 Apr 2026 16:12:07 +0100 Subject: [PATCH 1/2] Update .gitignore to exclude Python and Java files - Add .venv to ignore Python virtual environments - Add *.class to ignore Java compiled class files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3c3629e64..be3563007 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules +.venv +*.class \ No newline at end of file From 9a3ec37b76e38287fd13ed42ba24501c9f73a6fe Mon Sep 17 00:00:00 2001 From: iswat Date: Tue, 14 Apr 2026 12:04:30 +0100 Subject: [PATCH 2/2] Implement cowsay command-line tool - Create cow.py with argparse for command-line argument parsing - Support dynamic animal selection with --animal flag (defaults to "cow") - Accept message as positional arguments and join them - Use getattr() to dynamically call animal functions from cowsay library - Fetch available animals from cowsay.CHARS instead of hardcoding - Add requirements.txt with cowsay dependency --- implement-cowsay/cow.py | 21 +++++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 2 files changed, 22 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..f7c647e2b --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,21 @@ +import argparse +import cowsay + +available_animals = cowsay.CHARS + +parser = argparse.ArgumentParser(prog="cowsay") +parser.add_argument("message", nargs="+", help="What the animal will say") +parser.add_argument( + "--animal", + choices=available_animals.keys(), + default="cow", + help="The animal that will say the word", +) + +args = parser.parse_args() + +message_joined = " ".join(args.message) + +animal = args.animal + +getattr(cowsay, animal)(message_joined) diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 000000000..cc5571034 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay \ No newline at end of file