Skip to content

Commit 3dc7b20

Browse files
London | 26-Mar-SDC | beko | Sprint 4| implement cosway
1 parent d3857c2 commit 3dc7b20

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

implement-cowsay/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.venv
2+
.vscode/*

implement-cowsay/cow.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import argparse
2+
import cowsay
3+
4+
available_animals = cowsay.CHARS
5+
6+
parser = argparse.ArgumentParser(prog="cowsay", description="Make animals say things")
7+
parser.add_argument("message", nargs="+", help="here is the message that the animal will say")
8+
parser.add_argument(
9+
"--animal",
10+
choices=available_animals.keys(),
11+
default="cow",
12+
help="The animal to be saying things.",
13+
)
14+
15+
args = parser.parse_args()
16+
17+
message_joined = " ".join(args.message)
18+
19+
animal = args.animal
20+
21+
getattr(cowsay, animal)(message_joined)

implement-cowsay/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cowsay

0 commit comments

Comments
 (0)