aboutsummaryrefslogtreecommitdiff
path: root/.run/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-02 10:33:38 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-02 10:49:47 +0800
commit37bbc0ccf6ca34c1163384742f172741a5322c75 (patch)
tree77c6b9b03d895be51590f2c410582618b894f320 /.run/src
feat: add cross-platform script runner with run.sh and run.ps1
Diffstat (limited to '.run/src')
-rw-r--r--.run/src/bin/csharp-script.cs8
-rw-r--r--.run/src/bin/powrshell-script.ps18
-rw-r--r--.run/src/bin/python-script.py11
-rw-r--r--.run/src/bin/rust-script.rs12
-rw-r--r--.run/src/bin/shell-script.sh14
5 files changed, 53 insertions, 0 deletions
diff --git a/.run/src/bin/csharp-script.cs b/.run/src/bin/csharp-script.cs
new file mode 100644
index 0000000..1e7a3b7
--- /dev/null
+++ b/.run/src/bin/csharp-script.cs
@@ -0,0 +1,8 @@
+Console.WriteLine("");
+Console.WriteLine(" Welcome to use `run.sh` / `run.ps1`");
+Console.WriteLine("");
+Console.WriteLine(" > \"Hello World\"");
+Console.WriteLine(" > cwd : \"{0}\"", Environment.CurrentDirectory);
+var argStr = args.Length > 0 ? string.Join(", ", args.Select(a => $"\"{a}\"")) : "";
+Console.WriteLine(" > args : {0}", argStr);
+Console.WriteLine("");
diff --git a/.run/src/bin/powrshell-script.ps1 b/.run/src/bin/powrshell-script.ps1
new file mode 100644
index 0000000..70f3bae
--- /dev/null
+++ b/.run/src/bin/powrshell-script.ps1
@@ -0,0 +1,8 @@
+Write-Host ""
+Write-Host ' Welcome to use `run.sh` / `run.ps1`'
+Write-Host ""
+Write-Host ' > "Hello World"'
+Write-Host " > cwd : `"$(Get-Location)`""
+$items = ($args | ForEach-Object { "`"$_`"" }) -join ", "
+Write-Host " > args : $items"
+Write-Host ""
diff --git a/.run/src/bin/python-script.py b/.run/src/bin/python-script.py
new file mode 100644
index 0000000..9f4ff7b
--- /dev/null
+++ b/.run/src/bin/python-script.py
@@ -0,0 +1,11 @@
+import os
+import sys
+
+print()
+print(" Welcome to use `run.sh` / `run.ps1`")
+print()
+print(' > "Hello World"')
+print(f' > cwd : "{os.getcwd()}"')
+args = ", ".join(f'"{a}"' for a in sys.argv[1:])
+print(f" > args : {args}")
+print()
diff --git a/.run/src/bin/rust-script.rs b/.run/src/bin/rust-script.rs
new file mode 100644
index 0000000..19f4bcb
--- /dev/null
+++ b/.run/src/bin/rust-script.rs
@@ -0,0 +1,12 @@
+fn main() {
+ let args: Vec<String> = std::env::args().skip(1).collect();
+ let cwd = std::env::current_dir().unwrap();
+ println!();
+ println!(" Welcome to use `run.sh` / `run.ps1`");
+ println!();
+ println!(" > \"Hello World\"");
+ println!(" > cwd : \"{}\"", cwd.display());
+ let args_str: Vec<String> = args.iter().map(|a| format!("\"{}\"", a)).collect();
+ println!(" > args : {}", args_str.join(", "));
+ println!();
+}
diff --git a/.run/src/bin/shell-script.sh b/.run/src/bin/shell-script.sh
new file mode 100644
index 0000000..306afb5
--- /dev/null
+++ b/.run/src/bin/shell-script.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+echo ""
+echo ' Welcome to use `run.sh` / `run.ps1`'
+echo ""
+echo ' > "Hello World"'
+echo " > cwd : \"$(pwd)\""
+items=""
+sep=""
+for arg in "$@"; do
+ items="${items}${sep}\"${arg}\""
+ sep=", "
+done
+echo " > args : ${items}"
+echo ""