Skip to content

Commit

Permalink
Merge pull request #23 from fabioluciano/weather-plugins
Browse files Browse the repository at this point in the history
feat(weather-plugin): check for jq first
  • Loading branch information
fabioluciano authored May 30, 2024
2 parents 8e9c55f + e80576b commit 90a25a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugin/weather.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export plugin_weather_icon plugin_weather_accent_color plugin_weather_accent_col
plugin_weather_format_string=$(get_tmux_option "@theme_plugin_weather_format_string" "%t+H:%h")

function load_plugin() {
if ! command -v jq &>/dev/null; then
exit 1
fi

LOCATION=$(curl -s http://ip-api.com/json | jq -r '"\(.city), \(.country)"' 2>/dev/null)
WEATHER=$(curl -sL wttr.in/${LOCATION// /%20}\?format="${plugin_weather_format_string}" 2>/dev/null)

Expand Down

0 comments on commit 90a25a6

Please sign in to comment.