diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-14 14:25:00 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-14 14:25:00 +0800 |
| commit | 48a3fa1c27d2b9722f60dfaf062a0c71075a74f3 (patch) | |
| tree | 5828d5973a908aa869be2fbaf7657bb8d1389eb4 /run-tools.sh | |
| parent | 031771110c53ff903046c47882b418a5b4936d5b (diff) | |
Add script support to run-tools utilities
The run-tools.ps1 and run-tools.sh scripts now support running both
Rust binaries and shell scripts. They check dev_tools/scripts first,
then dev_tools/src/bin. Also added a simple HTTP preview script.
Diffstat (limited to 'run-tools.sh')
| -rwxr-xr-x | run-tools.sh | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/run-tools.sh b/run-tools.sh index 7bfcd29..c0c2c4a 100755 --- a/run-tools.sh +++ b/run-tools.sh @@ -4,24 +4,33 @@ cd "$(dirname "$0")" || exit 1 if [ $# -eq 0 ]; then echo "Available:" + if [ -d "dev_tools/scripts" ]; then + for file in dev_tools/scripts/*.sh; do + if [ -f "$file" ]; then + basename "$file" .sh + fi + done + fi if [ -d "dev_tools/src/bin" ]; then for file in dev_tools/src/bin/*.rs; do if [ -f "$file" ]; then basename "$file" .rs fi done - else - echo "Warning: dev_tools/src/bin directory does not exist" fi exit 1 fi target_bin="$1" +target_script="dev_tools/scripts/${target_bin}.sh" target_file="dev_tools/src/bin/${target_bin}.rs" -if [ ! -f "$target_file" ]; then - echo "Error: target file '$target_file' does not exist" +if [ -f "$target_script" ]; then + chmod +x "$target_script" + "$target_script" +elif [ -f "$target_file" ]; then + cargo run --manifest-path dev_tools/Cargo.toml --bin "$1" +else + echo "Error: target '$target_bin' does not exist" exit 1 fi - -cargo run --manifest-path dev_tools/Cargo.toml --bin "$1" |
