new mirror
[hband-tools.git] / gen-descriptions
blob7f1b9148c2cb2eaeaf0df9d767872d57f71977cd
1 #!/bin/bash
3 echo "| | |"
4 echo "|---|---|"
6 for filepath in admin-tools/* compiled-tools/*.pod crawler-bin/* root-tools/* user-tools/* xwin-tools/*
7 do
8 if [ -f "$filepath" ]
9 then
10 echo $'=pod\n\n=head1 FILEPATH '"$filepath"$'\n\n=cut\n\n'
11 cat "$filepath"
12 echo $'=pod\n\n=head1 EOF '"$filepath"$'\n\n=cut\n\n'
14 done |\
15 pod2text -w 10000 --utf8 |\
16 while IFS=$'\n' read line
18 if [[ $line =~ ^FILEPATH[\ \ ]+(.+) ]]
19 then
20 filepath=${BASH_REMATCH[1]}
21 dirpath=${filepath%/*}
23 elif [ "$line" = NAME ]
24 then
25 while IFS=$'\n' read line2
27 if [[ $line2 =~ ^[\ ]+([^ ]+)[\ ]+-[\ ]+(.+) ]]
28 then
29 name=${BASH_REMATCH[1]}
30 description=${BASH_REMATCH[2]}
32 filelink=$dirpath/$name
33 if [ "${filepath: -4}" = .pod ]
34 then
35 filelink=$dirpath/$name.c
37 if [ ! -e "$filelink" ]
38 then
39 filelink=($dirpath/*/$name.*)
40 filelink=${filelink[0]}
42 if [ ! -e "$filelink" ]
43 then
44 filelink=$filepath
47 echo "| [$name]($filelink) | $description"
48 elif [[ $line2 =~ ^[^\ \ ] ]]
49 then
50 break
52 done
54 done |\
55 sort -u