Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions implement-cowsay/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
21 changes: 21 additions & 0 deletions implement-cowsay/cow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import argparse
import cowsay

parser = argparse.ArgumentParser(
prog="cowsay",
description="implementing cowsay and other animals",
)

parser.add_argument("speak", nargs="+", help="what to speak about",)
parser.add_argument("--animal", choices=cowsay.char_names, default="cow", help="The animal to be saying things.",)

args = parser.parse_args()

speak = " ".join(args.speak)

output = cowsay.get_output_string(args.animal, speak)
print(output)

#I can use the below as another approach to print directly and almost like saying cowsay.turtle
# animal_function = cowsay.char_funcs[args.animal]
# animal_function(speak)
1 change: 1 addition & 0 deletions implement-cowsay/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cowsay
Loading