Skip to content

Commit e4a869a

Browse files
authored
Merge pull request #4 from ngirard/5wtcza-codex/add-taskgit---version-command
Add CLI version option
2 parents 81165aa + de8925d commit e4a869a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/taskgist/main.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ def main_cli():
139139
formatter_class=argparse.RawTextHelpFormatter,
140140
)
141141
parser.add_argument(
142-
"-v",
143142
"--version",
144-
action="version",
145-
version=f"%(prog)s {__version__}",
143+
action="store_true",
144+
help="Show program's version number and exit",
146145
)
147146
parser.add_argument(
148147
"task",
148+
nargs="?",
149149
type=str,
150150
help="The task description string, or a file path prefixed with '@:' (e.g., '@:path/to/task.txt').\n"
151151
'Example: taskgist "Create a new user authentication system"\n'
@@ -154,6 +154,13 @@ def main_cli():
154154

155155
args = parser.parse_args()
156156

157+
if args.version:
158+
print(f"{parser.prog} {__version__}")
159+
return
160+
161+
if args.task is None:
162+
parser.error("the following arguments are required: task")
163+
157164
try:
158165
task_description_content = get_task_description(args.task)
159166
except FileNotFoundError as e:

0 commit comments

Comments
 (0)