Skip to content

Commit d366915

Browse files
committed
Add CLI version option
1 parent d93c2e8 commit d366915

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()
@@ -127,6 +128,12 @@ def main_cli():
127128
description="Generates a concise gist from a software engineering task description using BAML.",
128129
formatter_class=argparse.RawTextHelpFormatter,
129130
)
131+
parser.add_argument(
132+
"-v",
133+
"--version",
134+
action="version",
135+
version=f"%(prog)s {__version__}",
136+
)
130137
parser.add_argument(
131138
"task",
132139
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)