Skip to content

Commit

Permalink
Add version number as a CLI argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kharvd committed Jul 11, 2023
1 parent ea0935e commit 0e2a78d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions gptcli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.3"
8 changes: 8 additions & 0 deletions gptcli/gpt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

import sys

MIN_PYTHON = (3, 9)
if sys.version_info < MIN_PYTHON:
sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON)
Expand Down Expand Up @@ -130,6 +131,13 @@ def parse_args(config: GptCliConfig):
help="Disable price logging.",
default=config.show_price,
)
parser.add_argument(
"--version",
"-v",
action="version",
version=f"gpt-cli v{gptcli.__version__}",
help="Print the version number and exit.",
)

return parser.parse_args()

Expand Down

0 comments on commit 0e2a78d

Please sign in to comment.