aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeicao-CatilGrass <1992414357@qq.com>2026-06-12 20:23:09 +0800
committerWeicao-CatilGrass <1992414357@qq.com>2026-06-12 20:23:09 +0800
commit834c2412fa6a795ff3bd793ad2bbb80e180a7702 (patch)
treecdbe5ae928bac22fe2b1a12b5cff0838a584f36c
parente94787a4f2633aee6578d54ad1bcbd97384634e4 (diff)
Pass through tool arguments to scripts and binaries
-rw-r--r--run-tools.ps19
-rwxr-xr-xrun-tools.sh7
2 files changed, 10 insertions, 6 deletions
diff --git a/run-tools.ps1 b/run-tools.ps1
index 9bea120..7aa2c9c 100644
--- a/run-tools.ps1
+++ b/run-tools.ps1
@@ -41,16 +41,19 @@ if ($target_name -match '^\d+$') {
}
}
+# Collect remaining arguments to pass to the script
+$script_args = $args[1..$args.Count]
+
$script_file_ps1 = "dev_tools/scripts/${target_name}.ps1"
$script_file_py = "dev_tools/scripts/${target_name}.py"
$rust_file = "dev_tools/src/bin/${target_name}.rs"
if (Test-Path $script_file_ps1) {
- & $script_file_ps1
+ & $script_file_ps1 $script_args
} elseif (Test-Path $script_file_py) {
- python $script_file_py
+ python $script_file_py $script_args
} elseif (Test-Path $rust_file) {
- cargo run --manifest-path dev_tools/Cargo.toml --bin $target_name --quiet
+ cargo run --manifest-path dev_tools/Cargo.toml --bin $target_name --quiet -- $script_args
} else {
Write-Host "Error: target '$target_name' does not exist as a script or Rust program"
exit 1
diff --git a/run-tools.sh b/run-tools.sh
index d50ca48..9a68f0e 100755
--- a/run-tools.sh
+++ b/run-tools.sh
@@ -34,6 +34,7 @@ if [ $# -eq 0 ]; then
fi
target_bin="$1"
+shift # Remove the first argument (tool name), keep the rest as tool arguments
# Check if input is a number
if [[ "$target_bin" =~ ^[0-9]+$ ]]; then
@@ -52,11 +53,11 @@ target_file="dev_tools/src/bin/${target_bin}.rs"
if [ -f "$target_script" ]; then
chmod +x "$target_script"
- "$target_script"
+ "$target_script" "$@"
elif [ -f "$target_python" ]; then
- python "$target_python"
+ python "$target_python" "$@"
elif [ -f "$target_file" ]; then
- cargo run --manifest-path dev_tools/Cargo.toml --bin "$target_bin" --quiet
+ cargo run --manifest-path dev_tools/Cargo.toml --bin "$target_bin" --quiet -- "$@"
else
echo "Error: target '$target_bin' does not exist"
exit 1