summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-10-17 22:34:33 +0200
committerBoris Faure <billiob@gmail.com>2013-10-17 22:34:33 +0200
commit457c32b72e35b93563c3fcdf6bd21613025e2a19 (patch)
treea13acd0608f081cd6a28b3ff85e2e9ac644a20e1
parent1c0b5abebbabf2e7fd1263e19593705ab1b89ee2 (diff)
slides with bullets \o/
-rwxr-xr-xtypres.sh120
1 files changed, 102 insertions, 18 deletions
diff --git a/typres.sh b/typres.sh
index ff8d9ed..b749bb4 100755
--- a/typres.sh
+++ b/typres.sh
@@ -3,24 +3,93 @@
3set -e 3set -e
4#set -x 4#set -x
5 5
6WL=0
7
8r() { 6r() {
9 echo -ne '\033}qs\0' && read -s s 7 echo -ne '\033}qs\0' && read -s s
10 COLUMNS=${s/;*} 8 COLUMNS=${s/;*}
11 LINES=${s#*;} 9 LINES=${s#*;}
12 LINES=${LINES/;*} 10 LINES=${LINES/;*}
13 WL=0 11 WL=1
14} 12}
15 13
14PWD=`pwd`
15
16t() { 16t() {
17 #TODO 17 local str=$@
18 echo "$@" 18 local len=$COLUMNS
19 local line=""
20 local lines=()
21 for w in $str; do
22 local l=${#w}
23 if [[ l -lt $len ]] ; then
24 len=$(( $len - $l - 1 ))
25 line="$line $w"
26 else
27 len=$COLUMNS
28 lines+=("$line")
29 line=""
30 fi
31 done;
32 if [[ -n $line ]]; then
33 lines+=("$line")
34 fi
35 for l in "${lines[@]}"; do
36 WL=$(( $WL + 1 ))
37 echo "$l"
38 done
19} 39}
20 40
21function b { 41function b {
22 #TODO 42 local bullets=( "$@" )
23 echo "$@" 43
44 local L=0
45 for str in "${bullets[@]}"; do
46 local len=$(( $COLUMNS - 2 ))
47 local line=""
48 for w in $str; do
49 local l=${#w}
50 if [[ l -lt $len ]] ; then
51 len=$(( $len - $l - 1 ))
52 line="$line $w"
53 else
54 len=$(( $COLUMNS - 2 ))
55 L=$(( $L + 1))
56 line=""
57 fi
58 done
59 if [[ -n $line ]]; then
60 L=$(( $L + 1))
61 fi
62 done
63
64 local l=$(( ($LINES - $WL - $L) / 2 ))
65 for I in $(seq 1 $l); do
66 echo ""
67 WL=$(( $WL + 1 ))
68 done
69
70 local L=0
71 for str in "${bullets[@]}"; do
72 echo -ne '\033}it#2;1;'$PWD'/item_00.png\0'
73 echo -ne '\033}ib\0##\033}ie\0'
74 local len=$(( $COLUMNS - 2 ))
75 local line=""
76 for w in $str; do
77 local l=${#w}
78 if [[ l -lt $len ]] ; then
79 len=$(( $len - $l - 1))
80 line="$line $w"
81 else
82 len=$(( $COLUMNS - 2 ))
83 echo "$line"
84 WL=$(( $WL + 1 ))
85 line=" $w"
86 fi
87 done
88 if [[ -n $line ]]; then
89 echo "$line"
90 WL=$(( $WL + 1 ))
91 fi
92 done
24} 93}
25 94
26vc() { 95vc() {
@@ -41,12 +110,12 @@ c() {
41 for w in $str; do 110 for w in $str; do
42 local l=${#w} 111 local l=${#w}
43 if [[ l -lt $len ]] ; then 112 if [[ l -lt $len ]] ; then
44 len=$(( $len - $l )) 113 len=$(( $len - $l - 1 ))
45 line="$line $w" 114 line="$line $w"
46 else 115 else
47 len=$COLUMNS 116 len=$COLUMNS
48 lines+=("$line") 117 lines+=("$line")
49 line="" 118 line="$w"
50 fi 119 fi
51 done; 120 done;
52 if [[ -n $line ]]; then 121 if [[ -n $line ]]; then
@@ -78,26 +147,39 @@ f() {
78function s01 { 147function s01 {
79 c "Terminology - Oct 2013 - Where are we?" 148 c "Terminology - Oct 2013 - Where are we?"
80 149
81 f $@ 150 #local h=$(( $LINES - $WL - 1 ))
151 #tycat -c -g ${COLUMNS}x9 terminology.png
152 #WL=$(( $WL + 9 ))
82} 153}
83function s02 { 154function s_end {
84 t "whoami" 155 c "Questions ?"
85 156
86 b "Boris Faure aka billiob" 157 #local h=$(( $LINES - $WL - 1 ))
87 b "developer on Enlightement and the EFL for 4 years" 158 #tycat -c -g ${COLUMNS}x9 terminology.png
159 #WL=$(( $WL + 9 ))
160}
161function s02 {
162 t "$ whoami"
88 163
89 f $@ 164 local bullets=("Boris Faure aka billiob" \
165 "developer on Enlightement and the EFL for 4 years" \
166 "working on terminology for more than a year")
167 b "${bullets[@]}"
90} 168}
91 169
92 170
93 171
94 172
95slides=(s01 s02) 173slides=(s01 s02 s_end)
96 174
97clear 175clear
98 176
177
178
179
99S=0 180S=0
100while true; do 181while true; do
182 clear
101 r 183 r
102 if [[ $S -ge ${#slides[@]} ]]; then 184 if [[ $S -ge ${#slides[@]} ]]; then
103 S=0 185 S=0
@@ -106,14 +188,16 @@ while true; do
106 S=$(( ${#slides[@]} - 1)) 188 S=$(( ${#slides[@]} - 1))
107 fi 189 fi
108 190
109 eval ${slides[$S]} "$S/${#slides[@]}" 191 eval ${slides[$S]}
192
193 f "$(($S+1))/${#slides[@]}"
110 read answer 194 read answer
111 case $answer in 195 case $answer in
112 q*) exit;; 196 q*) exit;;
113 n*) S=$(( $S + 1));; 197 n*) S=$(( $S + 1));;
114 p*) S=$(( $S - 1));; 198 p*) S=$(( $S - 1));;
115 r*) ;; 199 r*) ;;
116 *) S=$answer;; 200 *) S=$(( $answer - 1));;
117 esac 201 esac
118 202
119done 203done