summaryrefslogtreecommitdiff
path: root/typres.sh
blob: 02eb92bf1f214018193bad18669191a8a437285e (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/usr/bin/env bash

set -e
#set -x

r() {
    echo -ne '\033}qs\0' && read -s s
    COLUMNS=${s/;*}
    LINES=${s#*;}
    LINES=${LINES/;*}
    WL=1
}

PWD=`pwd`

t() {
    echo -ne '\033[0;97m'
    local str=$@
    local len=$COLUMNS
    local line=""
    local lines=()
    for w in $str; do
        local l=${#w}
        if [[ l -lt $len ]] ; then
            len=$(( $len - $l - 1 ))
            line="$line $w"
        else
            len=$COLUMNS
            lines+=("$line")
            line=""
        fi
    done;
    if [[ -n $line ]]; then
        lines+=("$line")
    fi
    for l in "${lines[@]}"; do
        WL=$(( $WL + 1 ))
        echo "$l"
    done
    echo -ne '\033[0m'
}

function b {
    local bullets=( "$@" )

    local L=0
    for str in "${bullets[@]}"; do
       local len=$(( $COLUMNS - 2 ))
       local line=""
       for w in $str; do
           local l=${#w}
           if [[ l -lt $len ]] ; then
               len=$(( $len - $l - 1 ))
               line="$line $w"
           else
               len=$(( $COLUMNS - 2 ))
               L=$(( $L + 1))
               line=""
           fi
       done
       if [[ -n $line ]]; then
           L=$(( $L + 1))
       fi
    done

    local l=$(( ($LINES - $WL - $L) / 2 ))
    for I in $(seq 1 $l); do
        echo ""
        WL=$(( $WL + 1 ))
    done

    local L=0
    for str in "${bullets[@]}"; do
       echo -ne '\033}it#2;1;'$PWD'/item_00.png\0'
       echo -ne '\033}ib\0##\033}ie\0'
       local len=$(( $COLUMNS - 2 ))
       local line=""
       for w in $str; do
           local l=${#w}
           if [[ l -lt $len ]] ; then
               len=$(( $len - $l - 1))
               line="$line $w"
           else
               len=$(( $COLUMNS - 2 ))
               echo "$line"
               WL=$(( $WL + 1 ))
               line="   $w"
           fi
       done
       if [[ -n $line ]]; then
           echo "$line"
           WL=$(( $WL + 1 ))
       fi
    done
}

vc() {
    local str=$@
    local spaces=$(( ($COLUMNS - ${#str}) / 2 ))
    for I in $(seq 1 $spaces); do
        echo -n " "
    done
    echo $str
    WL=$(( $WL + 1 ))
}

c() {
    echo -ne '\033[0;97m'
    local str=$@
    local lines=()
    local len=$COLUMNS
    local line=""
    for w in $str; do
        local l=${#w}
        if [[ l -lt $len ]] ; then
            len=$(( $len - $l - 1 ))
            line="$line $w"
        else
            len=$COLUMNS
            lines+=("$line")
            line="$w"
        fi
    done;
    if [[ -n $line ]]; then
        lines+=("$line")
    fi

    local l=$(( ($LINES - ${#lines[@]}) / 2 ))
    for I in $(seq 1 $l); do
        echo ""
        WL=$(( $WL + 1 ))
    done


    for l in "${lines[@]}"; do
        vc $l
    done
    echo -ne '\033[0m'
}

f() {
    WL=$(( $WL + 1 ))

    while [[ $WL -lt $LINES ]]; do
        echo ""
        WL=$(( $WL + 1 ))
    done
    echo -ne '\033[104;90m'
    echo $@
    echo -ne '\033[0m'
}

function s01 {
    c "Terminology - Oct 2013 - Where are we?"

    #local h=$(( $LINES - $WL - 1 ))
    #tycat -c -g ${COLUMNS}x9 terminology.png
    #WL=$(( $WL + 9 ))
}
function s_end {
    c "Questions ?"

    #local h=$(( $LINES - $WL - 1 ))
    #tycat -c -g ${COLUMNS}x9 terminology.png
    #WL=$(( $WL + 9 ))
}
function s02 {
    t "$ whoami"

    local bullets=("Boris Faure aka billiob" \
    "developer on Enlightement and the EFL for 4 years" \
    "working on terminology for more than a year")
    b "${bullets[@]}"
}




slides=(s01 s02 s_end)

clear




S=0
while true; do
    clear
    r
    if [[ $S -ge ${#slides[@]} ]]; then
        S=0
    fi
    if [[ $S -lt 0 ]]; then
        S=$(( ${#slides[@]} - 1))
    fi

    eval ${slides[$S]}

    f "$(($S+1))/${#slides[@]}"
    read answer
    case $answer in
        q*) exit;;
        n*) S=$(( $S + 1));;
        p*) S=$(( $S - 1));;
        r*) ;;
        *) S=$(( $answer - 1));;
    esac

done