From 48a3fa1c27d2b9722f60dfaf062a0c71075a74f3 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 14 Apr 2026 14:25:00 +0800 Subject: 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. --- run-tools.ps1 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'run-tools.ps1') 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] -- cgit