Skip to content

Commit

Permalink
Merge pull request #16 from thedadams/add-version
Browse files Browse the repository at this point in the history
feat: add version command
  • Loading branch information
thedadams authored Apr 26, 2024
2 parents 51b4f39 + a132560 commit 62c8113
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gptscript/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ def _get_command():
return os.path.join(python_bin_dir, "gptscript")


def version():
cmd = _get_command()
out, _ = exec_cmd(cmd, ["--version"])
return out


def list_tools():
cmd = _get_command()
out, _ = exec_cmd(cmd, ["--list-tools"])
Expand Down
6 changes: 6 additions & 0 deletions tests/test_gptscript.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pytest
from gptscript.command import (
version,
list_models,
list_tools,
exec,
Expand Down Expand Up @@ -70,6 +71,11 @@ def tool_list():
]


def test_version():
v = version()
assert "gptscript version " in v


# Test function for listing models
def test_list_models():
models = list_models()
Expand Down

0 comments on commit 62c8113

Please sign in to comment.