summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xflightquery.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/flightquery.sh b/flightquery.sh
index 16910e6..cb8edb3 100755
--- a/flightquery.sh
+++ b/flightquery.sh
@@ -33,10 +33,30 @@ _getdata() {
_arrivals() {
_getdata
+ # 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')
+ do
+ origin=$(_jq '.departure.airport')
+ takeoffSched=$(_jq '.departure.scheduled')
+ landingSched=$(_jq '.arrival.scheduled')
+ airline=$(_jq '.airline.name')
+ flightNumber=$(_jq '.flight.number')
+ echo "$airline $flightNumber Origin: $origin Takeoff: $takeoffSched Landed: $landingSched"
+ done
}
_departures() {
_getdata
+ # 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')
+ 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"
+ done
}
_flight() {
@@ -85,7 +105,7 @@ _flight() {
}
_help() {
- echo "Usage: !flight [option] [flight]. Options: -h help, -d departures, -a arrivals, -s source."
+ echo "Usage: !flight [option] [flight/airport]. Options: -h help, -d departures [airport], -a arrivals [airport], -s source. If no option is set then you must provide an IATA flight number e.g. BA2775."
}
if [[ ${input} == "-h" ]] || [[ ${input} == "--help" ]] || [[ -z $input ]]