lavat

Un fork de lavat pour pouvoir y ajouter des titres - retour accueil

git clone git://bebou.netlib.re/lavat
Log | Files | Refs | README | LICENSE |

pre (452B)


      1 #! /bin/sh
      2 
      3 gen() {
      4 	title="$1";
      5 	toilet -w 140 "$title" -f ansi > "$tmp"
      6 	l=$(< $tmp wc -l)
      7 	c=$(< $tmp head -n1 | wc -m)
      8 	w="$(($l/2))"
      9 	a=0;
     10 	while IFS= read line;do
     11 		printf "tb_printf(w/2-$c/2,h/2-$(($w-$a-1)),TB_DEFAULT,TB_DEFAULT,\"$line\");\n"
     12 		a=$(($a+1))
     13 	done < $tmp | sed 's/--/+/' | head -n-2
     14 }
     15 tmp=$(mktemp)
     16 title="$1"
     17 gen "$title" > $tmp
     18 < lavat.c awk -v f="$(cat $tmp)" '/^\tinsert_here/ {printf f"\n"};1' |
     19 	grep -Ev "^	insert_here"
     20