Skip to content

Commit f3851d5

Browse files
authored
Merge pull request #3 from ngirard/codex/add-taskgit---version-command
Add CLI version option
2 parents 7ca8079 + d366915 commit f3851d5

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ Taskgist requires a Google AI API key to interact with the Gemini LLM.
119119

120120
Once installed and configured, you can use the `taskgist` CLI. Ensure your virtual environment is activated if you're not using `just run` or `uv run`.
121121
122+
**Check the installed version:**
123+
```bash
124+
taskgist --version
125+
```
126+
122127
**Basic usage with a string input:**
123128
```bash
124129
taskgist "Create a new user authentication system with email verification and password reset capabilities"

src/taskgist/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .baml_client.async_client import b as ab # Using async client
1313
from .baml_client.types import KeywordPhrase
1414
from .baml_client.config import set_log_level
15+
from . import __version__
1516

1617
# Load environment variables from .env file at the earliest opportunity
1718
load_dotenv()
@@ -137,6 +138,12 @@ def main_cli():
137138
description="Generates a concise gist from a software engineering task description using BAML.",
138139
formatter_class=argparse.RawTextHelpFormatter,
139140
)
141+
parser.add_argument(
142+
"-v",
143+
"--version",
144+
action="version",
145+
version=f"%(prog)s {__version__}",
146+
)
140147
parser.add_argument(
141148
"task",
142149
type=str,

tests/test_version.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import subprocess
2+
import sys
3+
import unittest
4+
5+
import taskgist
6+
7+
8+
class TestVersionCLI(unittest.TestCase):
9+
def test_cli_version(self):
10+
result = subprocess.run(
11+
[sys.executable, "-m", "taskgist.main", "--version"],
12+
capture_output=True,
13+
text=True,
14+
)
15+
self.assertTrue(result.stdout.strip().endswith(taskgist.__version__))
16+
self.assertEqual(result.returncode, 0)
17+
18+
19+
if __name__ == "__main__":
20+
unittest.main()

0 commit comments

Comments
 (0)