summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-02 22:34:16 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-02 22:34:16 -0600
commitc8b10c484c2ebe2f320e19a8a7c9e9599ecb5024 (patch)
treee456c1a3f6139619d4ba6d1fbe39b5c696639aa6
parent6795ff85a9b7dc8c5204840171c1c3eb5b6e1eae (diff)
pbs-help: do some magic to sort the commands a little differently
-rwxr-xr-xpbs-help28
1 files changed, 27 insertions, 1 deletions
diff --git a/pbs-help b/pbs-help
index b60fad9..35157b8 100755
--- a/pbs-help
+++ b/pbs-help
@@ -4,9 +4,35 @@
stem=pbs
+presort() {
+ local r
+ while read -r cmd; do
+ r=6
+ case "$cmd" in
+ help) r=0;;
+ init) r=1;;
+
+ download|upload) r=2;;
+
+ package-fork|package-new) r=3;;
+ package-*commit) r=5;;
+ package-*) r=4;;
+
+ convert-*) r=8;;
+ plumb-*) r=9;;
+ esac
+ printf '%d;%s\n' "$r" "$cmd"
+ done
+}
+
+postsort() {
+ cut -d';' -f2
+}
+
list_commands() {
find ${PATH//:/ } -type f -executable -name "$stem-*" \
- -printf '%f\n' 2>/dev/null | sed "s/^${stem}-//;/--/d" | sort
+ -printf '%f\n' 2>/dev/null | sed "s/^${stem}-//;/--/d" |
+ presort | sort | postsort
}
master_usage() {