guilt: Working around missing touch -d on Darwin.
[guilt/mob.git] / Documentation / cmd-list.sh
blob9e33b813941a9d1590b1062af495bda6785aa310
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 "linkguilt:$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