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 e328bd5 commit c6b64e5Copy full SHA for c6b64e5
implement-cowsay/cow.py
@@ -0,0 +1,31 @@
1
+#!/usr/bin/env python3
2
+import cowsay
3
+import argparse
4
+
5
+def main():
6
7
+ animals = cowsay.char_names
8
9
+ # Set up command-line argument parsing
10
+ parser = argparse.ArgumentParser( prog="cowsay", description="Make animals say things")
11
+ parser.add_argument(
12
+ "--animal",
13
+ choices=animals,
14
+ default="cow",
15
+ help="The animal to be saying things."
16
+ )
17
18
+ "message",
19
+ nargs="+",
20
+ help="The message to say."
21
22
23
+ args = parser.parse_args()
24
25
+ message = " ".join(args.message)
26
27
+ say_function = getattr(cowsay, args.animal)
28
+ say_function(message)
29
30
+if __name__ == "__main__":
31
+ main()
implement-cowsay/requirements.txt
@@ -0,0 +1 @@
+cowsay
0 commit comments