diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-06-02 22:34:16 -0600 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-06-02 22:34:16 -0600 |
commit | c8b10c484c2ebe2f320e19a8a7c9e9599ecb5024 (patch) | |
tree | e456c1a3f6139619d4ba6d1fbe39b5c696639aa6 | |
parent | 6795ff85a9b7dc8c5204840171c1c3eb5b6e1eae (diff) |
pbs-help: do some magic to sort the commands a little differently
-rwxr-xr-x | pbs-help | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -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() { |