Skip to content

Commit 62c8113

Browse files
authored
Merge pull request #16 from thedadams/add-version
feat: add version command
2 parents 51b4f39 + a132560 commit 62c8113

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

gptscript/command.py

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ def _get_command():
2020
return os.path.join(python_bin_dir, "gptscript")
2121

2222

23+
def version():
24+
cmd = _get_command()
25+
out, _ = exec_cmd(cmd, ["--version"])
26+
return out
27+
28+
2329
def list_tools():
2430
cmd = _get_command()
2531
out, _ = exec_cmd(cmd, ["--list-tools"])

tests/test_gptscript.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import pytest
33
from gptscript.command import (
4+
version,
45
list_models,
56
list_tools,
67
exec,
@@ -70,6 +71,11 @@ def tool_list():
7071
]
7172

7273

74+
def test_version():
75+
v = version()
76+
assert "gptscript version " in v
77+
78+
7379
# Test function for listing models
7480
def test_list_models():
7581
models = list_models()

0 commit comments

Comments
 (0)