diff options
| -rwxr-xr-x | dev_tools/scripts/http-page-preview.sh | 3 | ||||
| -rw-r--r-- | mingling_core/src/program.rs | 2 | ||||
| -rw-r--r-- | run-tools.ps1 | 25 | ||||
| -rwxr-xr-x | run-tools.sh | 21 |
4 files changed, 38 insertions, 13 deletions
diff --git a/dev_tools/scripts/http-page-preview.sh b/dev_tools/scripts/http-page-preview.sh new file mode 100755 index 0000000..6c822d8 --- /dev/null +++ b/dev_tools/scripts/http-page-preview.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd "docs" +python3 -m http.server 3000 diff --git a/mingling_core/src/program.rs b/mingling_core/src/program.rs index cf8b06c..bee9772 100644 --- a/mingling_core/src/program.rs +++ b/mingling_core/src/program.rs @@ -257,7 +257,7 @@ macro_rules! __dispatch_program_chains { }; } -// Get all registered dispatcher names from the program +/// Get all registered dispatcher names from the program pub fn get_nodes<C: ProgramCollect<Enum = G>, G: Display>( program: &Program<C, G>, ) -> Vec<(String, &(dyn Dispatcher<G> + Send + Sync))> { 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] 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" |
