diff --git a/implement-cowsay/.gitignore b/implement-cowsay/.gitignore new file mode 100644 index 00000000..21d0b898 --- /dev/null +++ b/implement-cowsay/.gitignore @@ -0,0 +1 @@ +.venv/ diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..c6f868be --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,16 @@ +import argparse +import cowsay + +animals = list(cowsay.char_funcs.keys()) + +parser = argparse.ArgumentParser(description="implement Cowsay command") +parser.add_argument("text",nargs="+" ,help="Text to be displayed") +parser.add_argument("--animal", help=f"Animal to say the text (choices: {', '.join(animals)})", default="cow",choices=animals) +args = parser.parse_args() + +text = " ".join(args.text) +animal = args.animal + +cowsay.char_funcs[animal](text) + +