summaryrefslogtreecommitdiff
path: root/nws
diff options
context:
space:
mode:
Diffstat (limited to 'nws')
-rwxr-xr-xnws27
1 files changed, 23 insertions, 4 deletions
diff --git a/nws b/nws
index 581b305..26bd8ed 100755
--- a/nws
+++ b/nws
@@ -90,18 +90,37 @@ show_spc() {
}
get_forecast() {
+ colors
get_location
curl $(curl https://api.weather.gov/points/$cords | jq -r .properties.forecast) >> ~/.cache/.weather_forecast
- echo $(jq .properties.periods[0].name ~/.cache/.weather_forecast | sed 's/"//g'):
+ count=0
+ length=$(echo $(jq '.properties.periods | length' ~/.cache/.weather_forecast) -1 | bc)
+ while [ $count -le $length ]
+ do
+ echo ----------------------------------------------------------------------------------------------------
+ echo -e ${GREEN}Day: ${NOCOLOR}$(jq '.properties.periods['$count'].name' ~/.cache/.weather_forecast)
+ echo -e ${GREEN}Temperature: ${NOCOLOR}$(jq '.properties.periods['$count'].temperature' ~/.cache/.weather_forecast)$(jq '.properties.periods['$count'].temperatureUnit' ~/.cache/.weather_forecast)
+ echo -e ${GREEN}Rain chance: ${NOCOLOR}$(jq '.properties.periods['$count'].probabilityOfPrecipitation.value' ~/.cache/.weather_forecast)%
+ echo -e ${GREEN}Wind: ${NOCOLOR}$(jq '.properties.periods['$count'].windDirection' ~/.cache/.weather_forecast), $(jq '.properties.periods['$count'].windSpeed' ~/.cache/.weather_forecast)
+ echo
+ echo $(jq '.properties.periods['$count'].detailedForecast' ~/.cache/.weather_forecast)
+ echo
+ echo ----------------------------------------------------------------------------------------------------
+ echo
+ echo
+ ((count++))
+ done
echo ""
}
help() {
- echo "tw"
+ echo "nws"
echo " --full-radar: shows radar of entire US"
echo " --radar: shows local radar"
echo " --spc: shows storm predictions"
echo " --retrieve-counties: shows county ids"
+ echo " --ca: shows number of alerts"
+ echo " -a: shows alerts"
echo " -f: shows local forecast"
}
@@ -113,8 +132,8 @@ case $1 in
'--retrieve-counties') retrieve_counties;;
'--ca') count_alerts;;
'-t') show_timing;;
- '-a') show_alerts | less -R;;
- '-f') get_forecast;;
+ '-a') show_alerts | sed 's/null//g ; s/"//g' |less -R;;
+ '-f') get_forecast | sed 's/"//g' | less -R;;
'-h') help;;
"") help;;
esac