From 1f889d429133f920411db8ea1b88a68657f79435 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 2 Jul 2026 15:00:23 +0800 Subject: feat: add support for Ruby, Perl, Go, Zig, and Nim scripts --- run.ps1 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ run.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/run.ps1 b/run.ps1 index bfea866..782fd46 100644 --- a/run.ps1 +++ b/run.ps1 @@ -26,6 +26,36 @@ if (Test-Path ".run/src/bin/*.ps1") { } } +if (Test-Path ".run/src/bin/*.rb") { + Get-ChildItem -Path ".run/src/bin/*.rb" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "rb"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.pl") { + Get-ChildItem -Path ".run/src/bin/*.pl" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "pl"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.go") { + Get-ChildItem -Path ".run/src/bin/*.go" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "go"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.zig") { + Get-ChildItem -Path ".run/src/bin/*.zig" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "zig"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.nim") { + Get-ChildItem -Path ".run/src/bin/*.nim" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "nim"; Path = $_.FullName } + } +} + if (Test-Path ".run/src/bin/*.exe") { Get-ChildItem -Path ".run/src/bin/*.exe" | ForEach-Object { $tools[$_.BaseName] = @{ Type = "exe"; Path = $_.FullName } @@ -59,6 +89,11 @@ if ($args.Count -eq 0) { "py" { "Python" } "rs" { "Rust" } "ps1" { "PowerShell" } + "rb" { "Ruby" } + "pl" { "Perl" } + "go" { "Go" } + "zig" { "Zig" } + "nim" { "Nim" } "exe" { "Binary" } } $entry = " " + $i.ToString().PadRight($num_w) + ") " + $name.PadRight($max_name) + " [$lang]" @@ -96,6 +131,21 @@ switch ($info.Type) { "ps1" { & $info.Path @script_args } + "rb" { + ruby $info.Path $script_args + } + "pl" { + perl $info.Path $script_args + } + "go" { + go run $info.Path $script_args + } + "zig" { + zig run $info.Path $script_args + } + "nim" { + nim r --hints:off $info.Path $script_args + } "exe" { & $info.Path $script_args } diff --git a/run.sh b/run.sh index 1d58ffa..13ee953 100644 --- a/run.sh +++ b/run.sh @@ -32,6 +32,41 @@ for file in .run/src/bin/*.sh; do fi done +for file in .run/src/bin/*.rb; do + if [ -f "$file" ]; then + name=$(basename "$file" .rb) + tools["$name"]="rb" + fi +done + +for file in .run/src/bin/*.pl; do + if [ -f "$file" ]; then + name=$(basename "$file" .pl) + tools["$name"]="pl" + fi +done + +for file in .run/src/bin/*.go; do + if [ -f "$file" ]; then + name=$(basename "$file" .go) + tools["$name"]="go" + fi +done + +for file in .run/src/bin/*.zig; do + if [ -f "$file" ]; then + name=$(basename "$file" .zig) + tools["$name"]="zig" + fi +done + +for file in .run/src/bin/*.nim; do + if [ -f "$file" ]; then + name=$(basename "$file" .nim) + tools["$name"]="nim" + fi +done + for file in .run/src/bin/*; do if [ -f "$file" ]; then name=$(basename "$file") @@ -72,6 +107,11 @@ if [ $# -eq 0 ]; then py) lang="Python";; rs) lang="Rust";; sh) lang="Shell";; + rb) lang="Ruby";; + pl) lang="Perl";; + go) lang="Go";; + zig) lang="Zig";; + nim) lang="Nim";; binary) lang="Binary";; esac entry=$(printf " %-*d) %-*s [%s]" $num_w $i $max_name $name $lang) @@ -155,6 +195,21 @@ CSPROJ cp ".run/src/bin/$target_name.cs" "$temp_dir/Program.cs" dotnet run --project "$temp_dir/$target_name.csproj" -- "$@" ;; + rb) + ruby ".run/src/bin/$target_name.rb" "$@" + ;; + pl) + perl ".run/src/bin/$target_name.pl" "$@" + ;; + go) + go run ".run/src/bin/$target_name.go" "$@" + ;; + zig) + zig run ".run/src/bin/$target_name.zig" "$@" + ;; + nim) + nim r --hints:off ".run/src/bin/$target_name.nim" "$@" + ;; binary) chmod +x ".run/src/bin/$target_name" ".run/src/bin/$target_name" "$@" -- cgit