diff options
author | Asa Venton <asav1410@gmail.com> | 2020-10-31 05:14:39 +0000 |
---|---|---|
committer | Asa Venton <asav1410@gmail.com> | 2020-10-31 05:14:39 +0000 |
commit | 7ed1d3da600703294d9b06cf2258c2813a89080e (patch) | |
tree | 38e178567c83524523dc0d8f9bf3e8346f4d5659 /flightquery.sh | |
parent | ea688057dbee3f8d280bfcb9b19bfe89945ab286 (diff) |
Sort json in _arrivals and _departures by scheduled landing and takeoff respectively.
Diffstat (limited to 'flightquery.sh')
-rwxr-xr-x | flightquery.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/flightquery.sh b/flightquery.sh index b725350..2382fa6 100755 --- a/flightquery.sh +++ b/flightquery.sh @@ -33,8 +33,9 @@ _getdata() { _arrivals() { _getdata + result=$(echo $result | jq '.data | sort_by(.arrival.scheduled)') # TODO: Sort by something (arrival time?), limit to a certin number of flights (X before current time and Y after?) and format on single line of output - for json in $(echo "${result}" | jq -r '.data[] | @base64') + for json in $(echo "${result}" | jq -r '.[] | @base64') do origin=$(_jq '.departure.airport') takeoffSched=$(_jq '.departure.scheduled') @@ -47,15 +48,16 @@ _arrivals() { _departures() { _getdata + result=$(echo $result | jq '.data | sort_by(.departure.scheduled)') # TODO: Sort by something (departure time?), limit to a certin number of flights (X before current time and Y after?) and format on single line of output - for json in $(echo "${result}" | jq -r '.data[] | @base64') + for json in $(echo "${result}" | jq -r '.[] | @base64') do destination=$(_jq '.arrival.airport') takeoffSched=$(_jq '.departure.scheduled') landingSched=$(_jq '.arrival.scheduled') airline=$(_jq '.airline.name') flightNumber=$(_jq '.flight.number') - echo "$airline $flightNumber destination: $destination Takeoff: $takeoffSched Landed: $landingSched" + echo "$airline $flightNumber Destination: $destination Takeoff: $takeoffSched Landed: $landingSched" done } |