Created
April 26, 2020 19:04
-
-
Save sticklerm3/b75e0b6d2e82fa8384d128c61cb389a1 to your computer and use it in GitHub Desktop.
Revisions
-
sticklerm3 created this gist
Apr 26, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ zsh_weather(){ local weather=$(curl -s "https://api.apixu.com/v1/current.json?key="<Your API Key>"&q="<Your City>"") local temp=$(echo $weather | jq .current.temp_c) local condition=$(echo $weather | jq .current.condition.text) #Default value local color='%F{green}' local symbol="\uf2c7" if [[ $condition == *"rain"* ]] ; then symbol="\uf043" ; color='%F{blue}' fi if [[ $condition == *"cloudy"* || $condition == *"Overcast"* ]] ; then symbol="\uf0c2" ; color='%F{grey}'; fi if [[ $condition == *"Sunny"* ]] ; then symbol="\uf185" ; color='%F{yellow}'; fi echo -n "%{$color%}$temp\u2103 $symbol" }