move formating into output line

This commit is contained in:
Florian Schlegel 2020-08-29 12:51:48 +02:00
parent 6f2ae9daba
commit b4df98ba32
1 changed files with 1 additions and 7 deletions

View File

@ -223,14 +223,8 @@ while true; do
MILLIS=$((${STATION_ACTUAL_DEPARTURE[$i]} - STATION_NOW))
[ "$MILLIS" -lt 0 ] && MILLIS=0
SEKS=$((MILLIS / 1000)); MILLIS=$((MILLIS % 1000)); MINS=$((SEKS / 60)); SEKS=$((SEKS % 60))
MINSSPACE=""; SEKSSPACE=""; MILLISSPACE=""
[ "$MINS" -lt 100 ] && MINSSPACE=" " # FIXME (use printf)
[ "$MINS" -lt 10 ] && MINSSPACE=" " # FIXME (use printf)
[ "$SEKS" -lt 10 ] && SEKSSPACE=" " # FIXME (use printf)
[ "$MILLIS" -lt 100 ] && MILLISSPACE="0" # FIXME (use bash magic)
[ "$MILLIS" -lt 10 ] && MILLISSPACE="00" # FIXME (use bash magic)
MYOUTPUT="$MYOUTPUT\
\t\t${MINSSPACE}${MINS} min ${SEKSSPACE}${SEKS},${MILLISSPACE}${MILLIS} s │ $(printf "%-$((3-${#STATION_LINES[$i]}))s" "")${STATION_LINES[$i]}${STATION_DESTINATIONS[$i]}$(printf "%-$((29-${#STATION_DESTINATIONS[$i]}))s" "")\\n"
\t\t$(printf "%-$((3-${#MINS}))s" "")$MINS min $(printf "%-$((2-${#SEKS}))s" "")$SEKS,$(printf "%03d" $MILLIS) s │ $(printf "%-$((3-${#STATION_LINES[$i]}))s" "")${STATION_LINES[$i]}${STATION_DESTINATIONS[$i]}$(printf "%-$((29-${#STATION_DESTINATIONS[$i]}))s" "")\\n"
done
MYOUTPUT="$MYOUTPUT\
\t\t└────────────────────┴─────┴───────────────────────────────┘"