summaryrefslogtreecommitdiff
path: root/jh-list-commands.sh
blob: a099fae1b85ff6fde33f59c996eaf96e0d8c97b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Copyright © 2013 Luke Shumaker <lukeshu@sbcglobal.net>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the COPYING file for more details.

if [[ $# > 0 ]]; then
	jh-help $0 >>/dev/stderr
	exit 1
fi

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 | sort