Revert "Split non-ui functions in separate lib"
[gregoa/zavai.git] / polygen / zavai-polygen-update-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         if [ "`polygen $NAME | head -n 1 | cut -c 1`" == '<' ]
12         then
13                 T2="html"
14         else
15                 T2="text"
16         fi
17
18         if [ "`polygen -X 10 $NAME | wc -l`" == "10" ]
19         then
20                 T1="line"
21         else
22                 T1="block"
23         fi
24
25         NAME=${NAME:2}
26         NAME=${NAME%.grm}
27         TYPE="$T1/$T2"
28
29         echo "$NAME $TYPE $TITLE"
30 done