Skip to content

Commit

Permalink
refactor: rename scripts (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Jun 6, 2024
1 parent 6d1ad27 commit 2b07fc2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/functions.txt.test
/functions.json
/bin
/tools/test.*
/.env
*.cmd
__pycache__
12 changes: 6 additions & 6 deletions Argcfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build-bin() {
_build_win_shim $lang > "$bin_file"
else
bin_file="$BIN_DIR/$basename"
ln -s "$PWD/scripts/bin.$lang" "$bin_file"
ln -s "$PWD/scripts/run-tool.$lang" "$bin_file"
fi
else
not_found_funcs+=("$name")
Expand Down Expand Up @@ -111,7 +111,7 @@ build-single-declaration() {
func="$1"
lang="${func##*.}"
cmd="$(_lang_to_cmd "$lang")"
LLM_FUNCTION_ACTION=declarate "$cmd" "scripts/bin.$lang" "$func"
LLM_FUNCTION_ACTION=declarate "$cmd" "scripts/run-tool.$lang" "$func"
}

# @cmd List functions that can be put into functions.txt
Expand Down Expand Up @@ -151,8 +151,8 @@ test-functions() {
echo -n "Test $cmd_path: "
"$cmd_path" "$data"
if ! _is_win; then
echo -n "Test $cmd scripts/bin.$lang $func: "
"$cmd" "scripts/bin.$lang" "$func" "$data"
echo -n "Test $cmd scripts/run-tool.$lang $func: "
"$cmd" "scripts/run-tool.$lang" "$func" "$data"
fi
fi
done
Expand All @@ -175,7 +175,7 @@ install() {
# @cmd Create a boilplate tool script file.
# @arg args~
create() {
./scripts/create.sh "$@"
./scripts/create-tool.sh "$@"
}

# @cmd Show pre-requisite tool versions
Expand Down Expand Up @@ -219,7 +219,7 @@ set "bin_dir=%~dp0"
for %%i in ("%bin_dir:~0,-1%") do set "script_dir=%%~dpi"
set "script_name=%~n0"
$run "%script_dir%scripts\bin.$lang" "%script_name%.$lang" %*
$run "%script_dir%scripts\run-tool.$lang" "%script_name%.$lang" %*
EOF
}

Expand Down
1 change: 1 addition & 0 deletions scripts/create.sh → scripts/create-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
# It automatically generate declaration json for `*.py` and `*.js` and generate `@option` tags for `.sh`.
# Examples:
# argc create abc.sh foo bar! baz+ qux*
# ./scripts/create-tool.sh test.py foo bar! baz+ qux*
# @arg name! The script file name.
# @arg params* The script parameters

Expand Down
2 changes: 1 addition & 1 deletion scripts/bin.js → scripts/run-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function parseArgv() {
let funcName = process.argv[1];
let funcData = null;

if (funcName.endsWith("bin.js")) {
if (funcName.endsWith("run-tool.js")) {
funcName = process.argv[2];
funcData = process.argv[3];
} else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/bin.py → scripts/run-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def parse_argv():
func_name = sys.argv[0]
func_data = None

if func_name.endswith("bin.py"):
if func_name.endswith("run-tool.py"):
func_name = sys.argv[1] if len(sys.argv) > 1 else None
func_data = sys.argv[2] if len(sys.argv) > 2 else None
else:
Expand Down
2 changes: 1 addition & 1 deletion scripts/bin.sh → scripts/run-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ -f "$LLM_FUNCTIONS_DIR/.env" ]]; then
source "$LLM_FUNCTIONS_DIR/.env"
fi

if [[ "$0" == *bin.sh ]]; then
if [[ "$0" == *run-tool.sh ]]; then
func_name="$1"
func_data="$2"
else
Expand Down

0 comments on commit 2b07fc2

Please sign in to comment.