aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run.ps16
-rw-r--r--run.sh24
2 files changed, 24 insertions, 6 deletions
diff --git a/run.ps1 b/run.ps1
index af8effe..f0b575d 100644
--- a/run.ps1
+++ b/run.ps1
@@ -8,6 +8,8 @@
# You can go to [https://catilgrass.github.io/run] to install it
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+# Version: 0.1.1
+
Set-Location -Path (Split-Path -Parent $MyInvocation.MyCommand.Path) -ErrorAction Stop
$tools = @{}
@@ -73,7 +75,7 @@ if (Test-Path ".run/src/bin/*.zig") {
}
if ($args.Count -eq 0) {
- $sorted = @($tools.Keys | Sort-Object @{Expression={if ($tools[$_].Type -eq 'ps1') {0} else {1}}}, {$_})
+ $sorted = @($tools.Keys | Sort-Object @{Expression={if ($_[0] -cmatch '[A-Z]') {0} else {1}}}, @{Expression={if ($tools[$_].Type -eq 'ps1') {0} else {1}}}, {$_})
$total = $sorted.Count
$num_w = $total.ToString().Length
@@ -120,7 +122,7 @@ if ($args.Count -eq 0) {
$target_name = $args[0]
if ($target_name -match '^\d+$') {
- $sorted = @($tools.Keys | Sort-Object @{Expression={if ($tools[$_].Type -eq 'ps1') {0} else {1}}}, {$_})
+ $sorted = @($tools.Keys | Sort-Object @{Expression={if ($_[0] -cmatch '[A-Z]') {0} else {1}}}, @{Expression={if ($tools[$_].Type -eq 'ps1') {0} else {1}}}, {$_})
$idx = [int]$target_name - 1
if ($idx -ge 0 -and $idx -lt $sorted.Count) {
$target_name = $sorted[$idx]
diff --git a/run.sh b/run.sh
index cc03790..c4079cb 100644
--- a/run.sh
+++ b/run.sh
@@ -10,6 +10,8 @@
# You can go to [https://catilgrass.github.io/run] to install it
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+# Version: 0.1.1
+
cd "$(dirname "$0")" || exit 1
declare -A tools
@@ -89,11 +91,18 @@ done
if [ $# -eq 0 ]; then
sorted_names=($(
for name in "${!tools[@]}"; do
+ first_char="${name:0:1}"
+ if [[ "$first_char" =~ [A-Z] ]]; then
+ case_pri="0"
+ else
+ case_pri="1"
+ fi
if [ "${tools[$name]}" = "sh" ]; then
- echo "0 $name"
+ lang_pri="0"
else
- echo "1 $name"
+ lang_pri="1"
fi
+ echo "$case_pri$lang_pri $name"
done | sort | while read -r _ n; do echo "$n"; done
))
total=${#sorted_names[@]}
@@ -149,11 +158,18 @@ shift
if [[ "$target_name" =~ ^[0-9]+$ ]]; then
sorted=($(
for name in "${!tools[@]}"; do
+ first_char="${name:0:1}"
+ if [[ "$first_char" =~ [A-Z] ]]; then
+ case_pri="0"
+ else
+ case_pri="1"
+ fi
if [ "${tools[$name]}" = "sh" ]; then
- echo "0 $name"
+ lang_pri="0"
else
- echo "1 $name"
+ lang_pri="1"
fi
+ echo "$case_pri$lang_pri $name"
done | sort | while read -r _ n; do echo "$n"; done
))
idx=$((target_name - 1))