summaryrefslogtreecommitdiff
path: root/nws
diff options
context:
space:
mode:
authorstkhan <personal@slickd.xyz>2024-06-03 21:08:56 -0500
committerstkhan <personal@slickd.xyz>2024-06-03 21:08:56 -0500
commitfaa5b0d19dd308fe2087770100949c11ea904ab0 (patch)
treee9fb9cb626e0632881b91eca596d1ab341cc2e66 /nws
parent72ffb159880af4e18052244748b1b81ac7a906cb (diff)
fix cleanup, and add version arg
Diffstat (limited to 'nws')
-rwxr-xr-xnws8
1 files changed, 5 insertions, 3 deletions
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