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.ps1 | |
| 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.ps1')
| -rw-r--r-- | run-tools.ps1 | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/run-tools.ps1 b/run-tools.ps1 index fa06ecd..43e39d8 100644 --- a/run-tools.ps1 +++ b/run-tools.ps1 @@ -12,15 +12,28 @@ if ($args.Count -eq 0) { } else { Write-Host "Warning: dev_tools/src/bin directory does not exist" } + if (Test-Path "dev_tools/scripts") { + $scripts = Get-ChildItem -Path "dev_tools/scripts/*.ps1" + foreach ($script in $scripts) { + if ($script -is [System.IO.FileInfo]) { + Write-Host $script.BaseName + } + } + } else { + Write-Host "Warning: dev_tools/scripts directory does not exist" + } exit 1 } -$target_bin = $args[0] -$target_file = "dev_tools/src/bin/${target_bin}.rs" +$target_name = $args[0] +$script_file = "dev_tools/scripts/${target_name}.ps1" +$rust_file = "dev_tools/src/bin/${target_name}.rs" -if (-not (Test-Path $target_file)) { - Write-Host "Error: target file '$target_file' does not exist" +if (Test-Path $script_file) { + & $script_file +} elseif (Test-Path $rust_file) { + cargo run --manifest-path dev_tools/Cargo.toml --bin $target_name +} else { + Write-Host "Error: target '$target_name' does not exist as a script or Rust program" exit 1 } - -cargo run --manifest-path dev_tools/Cargo.toml --bin $args[0] |
