mirror of
https://github.com/shokinn/.files.git
synced 2025-01-18 21:22:25 +00:00
add function to .zshrc to display weather informations with curl using http://wttr.in
This commit is contained in:
parent
30b1f332a6
commit
d1dc74a3f6
|
@ -123,3 +123,31 @@ fi
|
|||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
alias dotdrop='eval $(grep -v "^#" ~/.files/.env.public) ~/.files/dotdrop.sh'
|
||||
|
||||
# Funktions (or more complex aliasses)
|
||||
wttr() {
|
||||
if [ -z "$1" ]; then
|
||||
curl http://wttr.in
|
||||
elif [[ "$1" == "help" ]]; then
|
||||
cat << EOF
|
||||
usage: wttr (City|3-letter airport code|'~Special+Location')
|
||||
City:
|
||||
Just write down the name of the city.
|
||||
e.G.:
|
||||
wttr London
|
||||
3-letter airport code:
|
||||
Use 3-letter airport codes in order to get the weather information at a certain airport.
|
||||
e.G.:
|
||||
wttr muc #for Munich Internation Airpot, Germany
|
||||
Special Location:
|
||||
Let's say you'd like to get the weather for a geographical location other than a town or city -
|
||||
maybe an attraction in a city, a mountain name, or some special location.
|
||||
Add the character '~' before the name to look up that special location name before the weather is then retrieved.
|
||||
e.G.:
|
||||
wttr '~Eiffel+Tower'
|
||||
wttr '~Kilimanjaro'
|
||||
EOF
|
||||
else
|
||||
curl http://wttr.in/$1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue