summaryrefslogtreecommitdiff
path: root/jh-list-commands.sh
diff options
context:
space:
mode:
Diffstat (limited to 'jh-list-commands.sh')
-rw-r--r--jh-list-commands.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/jh-list-commands.sh b/jh-list-commands.sh
index 143f6e7..66ce5aa 100644
--- a/jh-list-commands.sh
+++ b/jh-list-commands.sh
@@ -1,13 +1,17 @@
#!/bin/bash
-. jh
if [[ $# > 0 ]]; then
- usage
+ jh-help $0 >>/dev/stderr
exit 1
fi
-for cmd_help in "$JH_PATH"/*.help.txt; do
- cmd=`echo "$cmd_help"|sed -r 's|.*/jh-(.*)\.help\.txt$|\1|'`
+stem=jh
+
+find ${PATH//:/ } -type f -name "$stem-*.help.txt" 2>/dev/null |
+while read cmd_help; do
+ cmd=$cmd_help
+ cmd=${cmd%.help.txt}
+ cmd=${cmd##*/$stem-}
help=`sed -n 2p "$cmd_help"`
- printf "%-20s %s\n" "$cmd" "$help"
-done
+ printf '%-20s %s\n' "$cmd" "$help"
+done | sort