mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
New plugin weather information
This commit is contained in:
parent
ac9a8cb687
commit
40ea076f1e
2 changed files with 31 additions and 0 deletions
19
plugins/weather/README.md
Normal file
19
plugins/weather/README.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
# Weather plugin
|
||||
|
||||
This plugin uses the wego web fronted [wttr.in](https://github.com/chubin/wttr.in) to obtain weather information.
|
||||
|
||||
## Usage
|
||||
|
||||
Get weather info of a location from a shell typing ```weather {city}```:
|
||||
|
||||
$ weather
|
||||
Weather for City: Madrid, Spain
|
||||
|
||||
\ / Clear
|
||||
.-. 25 °C
|
||||
― ( ) ― ↘ 2 km/h
|
||||
`-’ 10 km
|
||||
/ \ 0.0 mm
|
||||
|
||||
You can specify the location, for that you want to get the weather information. If you omit the location name, you will get the information for you current location, based on your IP address.
|
||||
12
plugins/weather/weather.plugin.zsh
Normal file
12
plugins/weather/weather.plugin.zsh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/zsh
|
||||
|
||||
################################################################################
|
||||
# This function shows the current weather info of the location passed
|
||||
# by argument (your current location if no location is passed).
|
||||
# e.g.: weather
|
||||
# e.g.: weather Madrid
|
||||
################################################################################
|
||||
function weather {
|
||||
command -v 'curl' > /dev/null 2>&1 && \
|
||||
curl "wttr.in/$1" -s | head -n 7
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue