aboutsummaryrefslogtreecommitdiff
path: root/run.sh
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-11 13:53:29 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-11 13:53:29 +0800
commit9b1a5a0a97601b3e761730bb3ce011e14fcbdfc4 (patch)
tree784bc178779a23034e4c0d6822e2900fdc946d01 /run.sh
parent685f461e181a22b6112ab2ee3ed9caba46998c4b (diff)
feat: Sort uppercase tool names before lowercase in listingsHEADmaster
Add version header 0.1.1 to both run.ps1 and run.sh
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh24
1 files changed, 20 insertions, 4 deletions
diff --git a/run.sh b/run.sh
index cc03790..c4079cb 100755
--- 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))