Récupérer un itinéraire sur le réseau CTS - retour accueil
git clone git://bebou.netlib.re/cts
Log | Files | Refs | README |
ctsui (1386B)
1 #! /bin/sh 2 3 printf "De\n" 4 from=$(cat /usr/share/cts/address | fzy | 5 tr -d '\n' | xargs -0 -I{} grep "^{}$" /usr/share/cts/address) 6 fromid=$(echo "$from" | cut -f4) 7 fromtype=$(echo "$from" | cut -f3) 8 9 printf "A\n" 10 to=$(cat /usr/share/cts/address | fzy | 11 tr -d '\n' | xargs -0 -I{} grep "^{}$" /usr/share/cts/address) 12 toid=$(echo "$to" | cut -f4) 13 totype=$(echo "$to" | cut -f3) 14 15 printf "Date (YYYY-MM-DD), vide = aujourd'hui : \n" 16 17 d=$(< /usr/share/cts/dates sed -En "/$(date +%Y-%m-%d)/,$ p" | 18 fzy | 19 xargs -I{} grep "^{}$" /usr/share/cts/dates) 20 deporarr=$(printf "Partir à\nArriver à" | fzy) 21 printf "Heure (HHhMM), vide = maintenant : \n" 22 23 [ "$d" ] && date=" -j $d" || d="$(date +%Y-%m-%d)" 24 [ "$from" ] && from=" -d $fromid -i $fromtype" 25 [ "$to" ] && to=" -a $toid -o $totype" 26 [ "$deporarr" = "Arriver à" ] && deporarr="-f" || deporarr= 27 28 h=$(< /usr/share/cts/heures fzy | xargs -I{} grep "^{}$" /usr/share/cts/heures) 29 30 p="o" 31 while [ "$p" ] && [ "$p" != "stop" ];do 32 [ "$h" ] && heure=" -t $h" || h="$(date +"%Hh%M")" 33 clear 34 eval cts "$date" "$heure" "$deporarr" "$from" "$to" 35 printf "Voir les trajets\n" 36 p=$(echo "plus tard\nplus tôt\nstop" | fzy) 37 case $p in 38 ('plus tard') offset="5";; 39 ('plus tôt') offset="-5";; 40 esac 41 if [ "$p" ] && [ "$p" != "stop" ];then 42 h=$(date +"%Hh%M" --date="$(echo $h | tr 'h' ':') $d $offset minutes") 43 fi 44 done