We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0334e5a commit 5eb1779Copy full SHA for 5eb1779
implement-cowsay/.gitignore
@@ -11,3 +11,4 @@ env/
11
12
# macOS Finder file (ignore if on Mac)
13
.DS_Store
14
+name
implement-cowsay/cow.py
@@ -1,4 +1,30 @@
1
+import argparse
2
import cowsay
3
4
+parser = argparse.ArgumentParser(
5
+ prog="cowsay",
6
+ description="program to make animal say things"
7
+)
8
9
+# to fetch animals names
10
+animals = cowsay.char_names
+parser.add_argument(
+ "--animal",
+ choices=animals,
15
+ help="Animals to be saying things.",
16
+ default="cow"
17
18
+
19
20
+ "message",
21
+ nargs="+",
22
+ help="The message to say."
23
24
25
+args = parser.parse_args()
26
27
+# get the correct anima function by name
28
+animal_func = getattr(cowsay, args.animal)
29
30
+print(animal_func(" ".join(args.message)))
0 commit comments