From b5d16723abd78e5f5c4f558477c110c38844ddd8 Mon Sep 17 00:00:00 2001 From: ZabihollahNamazi Date: Sat, 28 Mar 2026 17:25:01 +0000 Subject: [PATCH] cowsay done --- implement-cowsay/cow.py | 28 ++++++++++++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 2 files changed, 29 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..d2279c1ae --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,28 @@ +import cowsay +import argparse + +#getting avalble animal list +animals = [a for a in dir(cowsay) if not a.startswith("__") and callable(getattr(cowsay, a))] + +parser = argparse.ArgumentParser( + prog="cowsay program", + description="Make animals say things" +) + +parser.add_argument( + "--animal", + default="cow", + choices=animals, + help=f"The animal to be saying things (choose from: {', '.join(animals)})" +) +parser.add_argument( + "message", + nargs="+", + help="message to show") + +args = parser.parse_args() + +text = " ".join(args.message) +animal = args.animal + +getattr(cowsay, animal)(text) \ 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