Treat grammars differently according to what they generate
[gregoa/zavai.git] / src / update-polygen-info
1 #!/bin/bash
2
3 TARGET=~/.zavai/polygen-info
4
5 exec > $TARGET
6
7 cd /usr/share/polygen
8 find . -name "*.grm" | sort | while read NAME
9 do
10         TITLE=`polygen -info $NAME | grep ^title: | head -1 | sed -re 's/^[^:]+: *//'`
11         NAME=${NAME:2}
12         NAME=${NAME%.grm}
13
14         if grep -Fqx $NAME ~/.zavai/polygen-line-text
15         then
16                 TYPE="line/text"
17         elif grep -Fqx $NAME ~/.zavai/polygen-line-html
18         then
19                 TYPE="line/html"
20         elif grep -Fqx $NAME ~/.zavai/polygen-block-html
21         then
22                 TYPE="block/html"
23         else
24                 TYPE="block/text"
25         fi
26
27         echo "$NAME $TYPE $TITLE"
28 done