diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..2707ca77 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,36 @@ +import argparse +import cowsay + +def main(): + # List of available animals (provided by the package) + animals = cowsay.char_names + + parser = argparse.ArgumentParser( + prog="cowsay", + description="Make animals say things" + ) + + parser.add_argument( + "message", + nargs="+", + help="The message to say." + ) + + parser.add_argument( + "--animal", + choices=animals, + default="cow", + help="The animal to be saying things." + ) + + args = parser.parse_args() + + message = " ".join(args.message) + + # Dynamically call the function for the chosen animal + animal_func = getattr(cowsay, args.animal) + animal_func(message) + + +if __name__ == "__main__": + main() diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 00000000..c6b9ffd0 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay