aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml4
-rw-r--r--Argcfile.sh2
-rwxr-xr-xscripts/bin.sh19
3 files changed, 16 insertions, 9 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 7fcea51..3d0b909 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -41,4 +41,6 @@ jobs:
python-version: '3.11'
- name: Run Test
- run: argc test \ No newline at end of file
+ run: argc test
+ env:
+ PYTHONIOENCODING: utf-8 \ No newline at end of file
diff --git a/Argcfile.sh b/Argcfile.sh
index 69bfaa6..a9d4ec2 100644
--- a/Argcfile.sh
+++ b/Argcfile.sh
@@ -221,7 +221,7 @@ set "bin_dir=%~dp0"
for %%i in ("%bin_dir:~0,-1%") do set "script_dir=%%~dpi"
set "script_name=%~n0"
-$run "%script_dir%cmd\cmd.$lang" "%script_name%.$lang" %*
+$run "%script_dir%scripts\bin.$lang" "%script_name%.$lang" %*
EOF
}
diff --git a/scripts/bin.sh b/scripts/bin.sh
index 77a6605..b5b1075 100755
--- a/scripts/bin.sh
+++ b/scripts/bin.sh
@@ -20,13 +20,15 @@ fi
FUNC_FILE="$LLM_FUNCTIONS_DIR/tools/$FUNC_FILE"
+export JQ=jq
if [[ "$OS" == "Windows_NT" ]]; then
+ export JQ="jq -b"
FUNC_FILE="$(cygpath -w "$FUNC_FILE")"
fi
if [[ "$LLM_FUNCTION_ACTION" == "declarate" ]]; then
argc --argc-export "$FUNC_FILE" | \
- jq -r '
+ $JQ -r '
def parse_description(flag_option):
if flag_option.describe == "" then
{}
@@ -74,23 +76,26 @@ else
data="$(
echo "$FUNC_DATA" | \
- jq -r '
+ $JQ -r '
to_entries | .[] |
(.key | split("_") | join("-")) as $key |
if .value | type == "array" then
- .value | .[] | "--\($key)\n\(.)"
+ .value | .[] | "--\($key)\n\(. | @json)"
elif .value | type == "boolean" then
if .value then "--\($key)" else "" end
else
- "--\($key)\n\(.value)"
- end' | \
- tr -d '\r'
+ "--\($key)\n\(.value | @json)"
+ end'
)" || {
echo "Invalid json data"
exit 1
}
while IFS= read -r line; do
- ARGS+=("$line")
+ if [[ "$line" == '--'* ]]; then
+ ARGS+=("$line")
+ else
+ ARGS+=("$(echo "$line" | $JQ -r '.')")
+ fi
done <<< "$data"
"$FUNC_FILE" "${ARGS[@]}"
fi \ No newline at end of file