Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 19 additions & 0 deletions implement-cowsay/cow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import cowsay
import sys

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think sys and os are used?

import argparse
import os

list_of_choices = cowsay.char_names


parser = argparse.ArgumentParser(
prog="cowsay",
description="Make animals say things",
)

parser.add_argument("--animal", nargs="?",default="cow", help="The animal to be saying things.", choices=list_of_choices)
parser.add_argument("message", nargs="*", default="", help="message to say")

args = parser.parse_args()

print(cowsay.get_output_string(str(args.animal)," ".join(args.message)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can format your code with ruff:

python3 -m pip install ruff
 ruff format

ruff can also be added to requirements.txt, same way as cowsay.

1 change: 1 addition & 0 deletions implement-cowsay/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cowsay