From 07d854468809fe49f8b1d4f08a0ce85615e3c62b Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 19:11:49 +0000 Subject: [PATCH 1/9] Add .venv directory to .gitignore for cowsay implementation --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3c3629e6..dd4c3bab 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +implement-cowsay/.venv. \ No newline at end of file From b65852da2c4cb9e64a06a5e8df3a380069afc2ee Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 19:12:04 +0000 Subject: [PATCH 2/9] Add initial implementation of cowsay in cow.py --- implement-cowsay/cow.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 implement-cowsay/cow.py diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..008e1d10 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,7 @@ +import cowsay +import sys + + +args = sys.argv[1:] + +cowsay.cow(' '.join(args)) \ No newline at end of file From 5aa1c285ba7976702c1d841910f416b0ce4852b9 Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 19:12:13 +0000 Subject: [PATCH 3/9] Add requirements.txt for cowsay dependency --- implement-cowsay/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 implement-cowsay/requirements.txt diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 00000000..c6b9ffd0 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay From 0ea57afc8c856eeae7cf7d94422126ee1ef0ae6d Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 19:41:39 +0000 Subject: [PATCH 4/9] Remove cowsay dependency from requirements.txt and update .gitignore --- .gitignore | 3 +-- implement-cowsay/requirements.txt | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 implement-cowsay/requirements.txt diff --git a/.gitignore b/.gitignore index dd4c3bab..b512c09d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -node_modules -implement-cowsay/.venv. \ No newline at end of file +node_modules \ No newline at end of file diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt deleted file mode 100644 index c6b9ffd0..00000000 --- a/implement-cowsay/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -cowsay From 3a5560521549d0068e42c5d157994f0c2b67922a Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 19:54:51 +0000 Subject: [PATCH 5/9] Add .venv directory for cowsay implementation to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b512c09d..dd4c3bab 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +implement-cowsay/.venv. \ No newline at end of file From 137146042f1df38d2de218a1ffa87b2c609dd699 Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 19:56:21 +0000 Subject: [PATCH 6/9] Add requirements.txt for cowsay dependency --- implement-cowsay/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 implement-cowsay/requirements.txt diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 00000000..cc557103 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay \ No newline at end of file From 49ce112bf2361d73ba46b4d67aab3e6050b70695 Mon Sep 17 00:00:00 2001 From: "[Elhadj Abdoul Diallo]" <[elhhabdouldiallo@gmail.com]> Date: Thu, 6 Mar 2025 20:21:41 +0000 Subject: [PATCH 7/9] Enhance cowsay implementation with argparse for dynamic animal selection and message input --- implement-cowsay/cow.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py index 008e1d10..c1b7b1a5 100644 --- a/implement-cowsay/cow.py +++ b/implement-cowsay/cow.py @@ -1,7 +1,14 @@ -import cowsay -import sys +import cowsay # type: ignore +import argparse +parser = argparse.ArgumentParser(description="Make animals say things") +parser.add_argument('--animal', choices=cowsay.char_names, help="The animal to be saying things", default="cow") +parser.add_argument('message', nargs='+', help="The message to say") -args = sys.argv[1:] +args = parser.parse_args() -cowsay.cow(' '.join(args)) \ No newline at end of file +char_name = args.animal +message = ' '.join(args.message) + +cowsay_func = getattr(cowsay, char_name) +cowsay_func(message) From b807c9814c8eb6a88dcc65ac2d2db58bd15f9ac6 Mon Sep 17 00:00:00 2001 From: eediallo Date: Tue, 18 Mar 2025 11:04:14 +0000 Subject: [PATCH 8/9] replace single quotes by double quotes and get rid of type ignore --- implement-cowsay/cow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py index c1b7b1a5..502e53fc 100644 --- a/implement-cowsay/cow.py +++ b/implement-cowsay/cow.py @@ -2,8 +2,8 @@ import argparse parser = argparse.ArgumentParser(description="Make animals say things") -parser.add_argument('--animal', choices=cowsay.char_names, help="The animal to be saying things", default="cow") -parser.add_argument('message', nargs='+', help="The message to say") +parser.add_argument("--animal", choices=cowsay.char_names, help="The animal to be saying things", default="cow") +parser.add_argument("message", nargs="+", help="The message to say") args = parser.parse_args() From a1a8be8e91dc047c51934f1598ad2b87a72cb33f Mon Sep 17 00:00:00 2001 From: eediallo Date: Tue, 18 Mar 2025 11:05:16 +0000 Subject: [PATCH 9/9] Fix import statement and unify string quotes in cowsay implementation --- implement-cowsay/cow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py index 502e53fc..35769cb2 100644 --- a/implement-cowsay/cow.py +++ b/implement-cowsay/cow.py @@ -1,4 +1,4 @@ -import cowsay # type: ignore +import cowsay import argparse parser = argparse.ArgumentParser(description="Make animals say things") @@ -8,7 +8,7 @@ args = parser.parse_args() char_name = args.animal -message = ' '.join(args.message) +message = " ".join(args.message) cowsay_func = getattr(cowsay, char_name) cowsay_func(message)