Skip to content
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
**/.venv
**/requirements.txt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't ignore the requirements file, it is important for the PR so people pulling know what library to install

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted!

Code has been updated

26 changes: 26 additions & 0 deletions implement-cowsay/cow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import cowsay
import argparse

def main():
# Get dynamic list of animals from the cowsay library
animals = cowsay.char_names

parser = argparse.ArgumentParser(
prog="cowsay",
description="Make animals say things"
)

parser.add_argument("--animal", choices=animals, default="cow",help="The animal to be saying things.")
parser.add_argument("message", nargs="+", help="The message to say.")

args = parser.parse_args()

# Join all message words into a single string
message = " ".join(args.message)

# Output the message using the selected animal or the default cow
cowsay.char_funcs[args.animal](message)


if __name__ == "__main__":
main()