diff --git a/.gitignore b/.gitignore index 3c3629e64..671215ddc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +.venv diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 000000000..0cbd01a0e --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,27 @@ +import argparse +import cowsay + +def main(): + # Set up argument parser + parser = argparse.ArgumentParser(description="Make animals say things") + parser.add_argument("message", nargs="+", help="The message to say.") + parser.add_argument( + "--animal", + choices=cowsay.char_names, + default="cow", + help="The animal to be saying things.", + ) + + args = parser.parse_args() + + # Combine the message into a single string + message = " ".join(args.message) + + # Get the animal function dynamically + animal_function = getattr(cowsay, args.animal, cowsay.cow) + + # Print the message using the selected animal + print(animal_function(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