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