diff options
-rwxr-xr-x | livetimes.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/livetimes.sh b/livetimes.sh index 34a7fd7..5bfe7a3 100755 --- a/livetimes.sh +++ b/livetimes.sh @@ -91,7 +91,7 @@ _nextbus() { nextbus=$(echo $timetables | jq -r --arg routeday "$routeday" --arg day "$day" --arg stop "$stop" '.timetables[] | select(.service_number == $stop) | .timetable.outbound[$routeday].trips[] | select(.days_of_operation[$day] == true) | .stops[] | select(.stop_name | contains("Bus Station Stand"))') for json in $(echo "${nextbus}" | jq -r '. | @base64'); do if [[ $(_jq '.departure_time') > $time ]]; then - echo "Route $stop leaving from $(_jq '.stop_name') at $(_jq '.departure_time')" + echo "Next route "$stop $futuretime"leaving from $(_jq '.stop_name') at $(_jq '.departure_time')" exit 0 fi done @@ -110,7 +110,7 @@ _nextbus() { esac nextbus=$(echo $timetables | jq -r --arg routeday "$routeday" --arg day "$day" --arg stop "$stop" '.timetables[] | select(.service_number == $stop) | .timetable.outbound[$routeday].trips[] | select(.days_of_operation[$day] == true) | .stops[] | select(.stop_name | contains("Bus Station Stand"))') if [[ ! -z "${nextbus// }" ]]; then - echo $(echo "Route $stop leaving from $(echo $nextbus | jq -s '.[0].stop_name') at $(echo $nextbus | jq -s '.[0].departure_time') on $(date -d $day +%A)" | sed 's/"//g') + echo $(echo "Next route "$stop $futuretime"leaving from $(echo $nextbus | jq -s '.[0].stop_name') at $(echo $nextbus | jq -s '.[0].departure_time') on $(date -d $day +%A)" | sed 's/"//g') exit 0 fi done @@ -142,6 +142,7 @@ elif [[ $(echo $stop | tr -cd ' \t' | wc -c) == 1 ]] && [[ "$stop" =~ [0-9][0-9] error="Invalid route provided - " _help else + futuretime="after $time, " _nextbus fi elif [[ ${stop,,} == *"bus"* ]] || [[ ${stop,,} == *"station"* ]] || [[ ${stop,,} == *"stand"* ]]; then |