Skip to content

Commit f9617e9

Browse files
committed
implamant cowsay func as a shell command written python
1 parent 407b010 commit f9617e9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

implement-cowsay/animalsay.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import cowsay
2+
import argparse
3+
4+
# cowsay.cow(" ".join(sys.argv[1:]))
5+
6+
# cowsay.turtle(" ".join(sys.argv[1:]))
7+
8+
# cowsay.fish(" ".join(sys.argv[1:]))
9+
10+
parser = argparse.ArgumentParser(
11+
prog = "cowsay shell command",
12+
description = "cowsay shell command on python Make animals say things"
13+
)
14+
animals = ["beavis","cheese","cow","daemon","dragon","fox","ghostbusters","kitty","meow","miki","milk","octopus","pig","stegosaurus","stimpy","trex","turkey","turtle","tux"]
15+
parser.add_argument("--animal", choices=animals, default = "cow", help="The animal to be saying things.")
16+
parser.add_argument("message", nargs="+", help="The message to say.")
17+
18+
args = parser.parse_args()
19+
20+
cowsay_function = getattr(cowsay, args.animal)
21+
cowsay_function(" ".join(args.message))
22+

0 commit comments

Comments
 (0)