Make "tg help cmd" print cmd help
[topgit/fonseca.git] / create-help.sh
blob0c40ee27899d60f0d9d62f84446156f110d0e7f0
1 #!/bin/sh
3 # Create the tg-foo.txt files which contain help for the tg-foo command.
5 if [ $# -ne 1 ] ; then
6 echo "Usage: $0 tgcommand" 1>&2
7 exit 1
8 fi
10 < README awk '
11 BEGIN { incommand = 0; }
12 /^tg '"$1"'$/ { incommand = 1; next; }
13 /^tg/ { incommand = 0; next; }
14 /^~/ { next; } # Ignore the title underlines.
15 { if (incommand) { print $0; } }
16 ' > tg-"$1".txt