Vendor the command set the menu and shell depend on
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# blob:summary=Returns a formatted weather status string with temperature and wind speed.
|
||||
|
||||
place=$(blob-weather-location 2>/dev/null)
|
||||
|
||||
if [[ -z $place ]]; then
|
||||
echo "Weather unavailable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
query=$(jq -rn --arg place "$place" '$place | @uri')
|
||||
weather=$(curl -fsS --max-time 4 "https://wttr.in/${query}?format=%t|%w" 2>/dev/null | tr -d '\n')
|
||||
|
||||
if [[ -z $weather ]]; then
|
||||
echo "Weather unavailable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IFS='|' read -r temperature wind <<< "$weather"
|
||||
place=${place^}
|
||||
temperature=${temperature#+}
|
||||
|
||||
echo "$place · Temp $temperature · Wind $wind"
|
||||
Reference in New Issue
Block a user