Skip to content

Commit

Permalink
add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
pgosar committed Apr 9, 2023
1 parent 9329081 commit 65da5c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions chatgdb/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import argparse
from os.path import abspath, dirname
from inspect import getfile, currentframe
from urllib.request import Request, urlopen
import json


def set_key(key):
Expand All @@ -10,6 +12,12 @@ def set_key(key):
f.write("OPENAI_KEY=\"" + key + "\"")


def version():
"""Return version information"""
with urlopen(Request("https://pypi.org/pypi/chatgdb/json"), timeout=10) as f:
return json.load(f)["info"]["version"]


def main():
parser = argparse.ArgumentParser(
description="Configure ChatGDB, the GDB chatbot",
Expand All @@ -19,6 +27,12 @@ def main():
"--key",
type=str,
help="Provide an api key for ChatGDB")
parser.add_argument(
'-v',
"--version",
action="version",
version="%(prog)s " + version(),
help="Print the version of ChatGDB")

args = parser.parse_args()
if args.key:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ChatGDB"
version = "1.0.3"
version = "1.0.4"
authors = ["Pranay Gosar <gosarpranay@gmail.com>"]
description = "Harness the power of ChatGPT directly inside the GDB debugger!"
readme = "README.md"
Expand Down

0 comments on commit 65da5c8

Please sign in to comment.