Skip to content

Commit

Permalink
feat: added --version option to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 10, 2023
1 parent a025c1c commit edb1982
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions gptme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""
# The above may be used as a prompt for the agent.
import atexit
import importlib.metadata
import io
import logging
import os
Expand Down Expand Up @@ -54,12 +55,11 @@
from .util import epoch_to_age, generate_unique_name

logger = logging.getLogger(__name__)

print_builtin = __builtins__["print"] # type: ignore

LLMChoice = Literal["openai", "llama"]
ModelChoice = Literal["gpt-3.5-turbo", "gpt4"]


Actions = Literal[
"continue",
"summarize",
Expand Down Expand Up @@ -236,6 +236,11 @@ def handle_cmd(
is_flag=True,
help="Show hidden system messages.",
)
@click.option(
"--version",
is_flag=True,
help="Show version.",
)
def main(
prompts: list[str],
prompt_system: str,
Expand All @@ -247,7 +252,13 @@ def main(
no_confirm: bool,
show_hidden: bool,
interactive: bool,
version: bool,
):
if version:
# print version and exit
print_builtin(f"gptme {importlib.metadata.version('gptme-python')}")
exit(0)

# log init
logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO)

Expand Down

0 comments on commit edb1982

Please sign in to comment.