summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstkhan <personal@slickd.xyz>2024-05-09 18:23:30 +0000
committerstkhan <personal@slickd.xyz>2024-05-09 18:23:30 +0000
commitf709af2f052bb5cefd1f6be0aba0c876d4c830ef (patch)
tree1189b2009577c59c94d925126915500376b3e6ea
parentae23a83d738df53fff11c0907dd0a93d02307365 (diff)
shows what location you're in
-rwxr-xr-xnws9
1 files changed, 8 insertions, 1 deletions
diff --git a/nws b/nws
index c4c5d17..2e6febc 100755
--- a/nws
+++ b/nws
@@ -31,7 +31,10 @@ retrieve_counties() {
get_location() {
- cords=$(curl ipinfo.io/json | jq -r .loc)
+ file=$(curl ipinfo.io/json >> /tmp/nws/loc)
+ cords=$(jq -r '.loc' /tmp/nws/loc)
+ city=$(jq -r '.city' /tmp/nws/loc)
+ state=$(jq -r '.region' /tmp/nws/loc)
}
show_radar() {
@@ -109,10 +112,14 @@ get_graphicast() {
get_forecast() {
colors
+ mkdir -p /tmp/nws/
get_location
curl $(curl https://api.weather.gov/points/$cords | jq -r .properties.forecast) >> ~/.cache/.weather_forecast
count=0
+ echo
length=$(echo $(jq '.properties.periods | length' ~/.cache/.weather_forecast) -1 | bc)
+ echo -e "Weather for ${GREEN}$city, $state${NOCOLOR}:"
+ echo
while [ $count -le $length ]
do
echo ----------------------------------------------------------------------------------------------------