guilt: replace "echo && return 1" with die
[guilt.git] / Documentation / cmd-list.sh
bloba6a68c7f4b99674f0aef345d92ff1027f7a0eb40
1 #!/bin/sh
3 format_one()
5 cmd=`echo $1 | sed -e 's/\.txt//'`
6 desc=`cat "$1" | awk '
7 BEGIN{state=0}
8 /^NAME$/{state=1; next}
9 /^----$/ && (state==1){state=2; next}
10 (state!=2){next}
11 {print $0; exit}
14 len=`expr length "$cmd"`
16 if [ -z "$desc" ]; then
17 echo "No description found in $cmd.txt" >&2
18 exit 1
19 elif [ "`expr substr \"$desc\" 1 $len`" != "$cmd" ]; then
20 echo "Description does not match $cmd: $desc" >&2
21 exit 1
24 echo "guiltlink:$cmd[1]::"
25 echo " $desc."
26 echo ""
29 for m in guilt-*.txt ; do
30 format_one "$m"
31 done > cmds.txt+
33 mv cmds.txt+ cmds.txt