-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen-tool.sh
executable file
·42 lines (39 loc) · 1.1 KB
/
gen-tool.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
red=1
green=148
blue=147
function color {
if [ -n "$1" ]; then
echo -e -n "\033[38;5;$1m"
else
echo -e -n "\033[39m"
fi
}
function message {
color $green
echo $1
color
}
for x in tasks/*/metadata; do
dir=`dirname $x`
setname=`cat $x | grep 'set-name:' | sed -e 's/^set-name: //'`
filename=$dir'/00-sada.tex'
echo $dir : $setname
(echo '% this file is generated automatically'; echo '\input ../../include/include.tex') > $filename
(echo ; echo '\begin{document}') >> $filename
echo '\velkynadpis{Začiatok sady - '$setname'}' >> $filename
(echo; echo '\begin{itemize}') >> $filename
prazdne='ano'
for x in `find $dir/ -maxdepth 1 -type d | sort -V`; do
name=`echo $x | sed -e 's/^.*\///' | sed -e 's/_/-/g'`
if [ ! -z $name ]; then
#echo $name
echo '\item '$name >> $filename
prazdne='nie'
fi
done
if [ "$prazdne" == 'ano' ]; then
echo '\item $<$Žiadne úlohy$>$' >> $filename
fi
(echo '\end{itemize}'; echo '\end{document}') >> $filename
done