aboutsummaryrefslogtreecommitdiffstats
path: root/Argcfile.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-07 21:58:46 +0800
committerGitHub <noreply@github.com>2024-06-07 21:58:46 +0800
commit0c6b609c261cb6f586668626d860dc6754725794 (patch)
treec41bb58e38908bbfa1430c7d2b10974ab8a873cf /Argcfile.sh
parent63df67acea19b3708d34ef3b656c1b784c2a72f4 (diff)
downloadllm-functions-docker-0c6b609c261cb6f586668626d860dc6754725794.tar.gz
refactor: demo_tool.* inspect LLM_* env vars (#33)
Diffstat (limited to 'Argcfile.sh')
-rw-r--r--Argcfile.sh45
1 files changed, 37 insertions, 8 deletions
diff --git a/Argcfile.sh b/Argcfile.sh
index 367eda0..2edf267 100644
--- a/Argcfile.sh
+++ b/Argcfile.sh
@@ -11,10 +11,10 @@ LANG_CMDS=( \
"py:python" \
)
-# @cmd Call the function
+# @cmd Run the tool
# @arg cmd![`_choice_cmd`] The function command
# @arg json The json data
-call() {
+run-tool() {
if _is_win; then
ext=".cmd"
fi
@@ -128,16 +128,18 @@ list-tools() {
# @cmd Test the project
test() {
- mkdir -p tmp/tests
- names_file=tmp/tests/functions.txt
- declarations_file=tmp/tests/functions.json
- argc list-tools > "$names_file"
- argc build --names-file "$names_file" --declarations-file "$declarations_file"
- argc test-tools
+ test-tools
}
# @cmd Test call functions
test-tools() {
+ tmp_dir="cache/tmp"
+ mkdir -p "$tmp_dir"
+ names_file="$tmp_dir/functions.txt"
+ declarations_file="$tmp_dir/functions.json"
+ argc list-tools > "$names_file"
+ argc build --names-file "$names_file" --declarations-file "$declarations_file"
+
if _is_win; then
ext=".cmd"
fi
@@ -162,6 +164,33 @@ test-tools() {
done
}
+# @cmd Test all demo tools
+test-demo-tools() {
+ for item in "${LANG_CMDS[@]}"; do
+ lang="${item%:*}"
+ echo "---- Test demo_tool.$lang ---"
+ argc build-bin "demo_tool.$lang"
+ argc run-tool demo_tool '{
+ "boolean": true,
+ "string": "Hello",
+ "string_enum": "foo",
+ "integer": 123,
+ "number": 3.14,
+ "array": [
+ "a",
+ "b",
+ "c"
+ ],
+ "string_optional": "OptionalValue",
+ "array_optional": [
+ "x",
+ "y"
+ ]
+}'
+ echo
+ done
+}
+
# @cmd Install this repo to aichat functions_dir
install() {
functions_dir="$(aichat --info | grep functions_dir | awk '{print $2}')"