From faa5b0d19dd308fe2087770100949c11ea904ab0 Mon Sep 17 00:00:00 2001 From: stkhan Date: Mon, 3 Jun 2024 21:08:56 -0500 Subject: fix cleanup, and add version arg --- nws | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'nws') diff --git a/nws b/nws index 5eaa617..9206f10 100755 --- a/nws +++ b/nws @@ -114,13 +114,14 @@ show_spc() { get_graphicast() { mkdir -p ~/.config/nws/cache/ + cleanup count=1 prog=12.5 bar="#" while [ $count -le 8 ] do wget -q -P ~/.config/nws/cache https://www.weather.gov/images/oun/graphicast/image${count}.png - echo -ne "${bar} (${prog}%)\r" + echo -ne "(${prog}%) | ${bar} \r" ((count++)) prog=$(echo "$prog + 12.5" | bc) bar="${bar}#" @@ -132,6 +133,7 @@ get_graphicast() { get_forecast() { colors + cleanup mkdir -p ~/.config/nws/cache/ get_location curl -s $(curl -s https://api.weather.gov/points/$cords | jq -r .properties.forecast) >> ~/.cache/.weather_forecast @@ -163,6 +165,7 @@ help() { echo echo "Basic operations:" echo + echo " -v: shows version" echo " -f: shows local forecast" echo " -a: shows weather alerts" echo " --radar (1,2,3): shows local radar" @@ -177,7 +180,6 @@ help() { echo " --gc: shows graphic forecast, uses image viewer set in config" echo } - radar_choice=$2 OUTPUT=$2 @@ -190,9 +192,9 @@ case $1 in '--gc') get_graphicast;; '-a') show_alerts | sed 's/null//g ; s/"//g' |less -R;; '-f') get_forecast | sed 's/"//g ; s/null/0/g' | less -R;; + '-v') echo nws $version;; '-h') help;; '--help') help;; "") help;; esac -cleanup -- cgit v1.2.3