From 40ea076f1e6e5f5b7fcd958e56172173f5ac3eb9 Mon Sep 17 00:00:00 2001 From: wachambo Date: Mon, 12 Sep 2016 00:11:51 +0200 Subject: [PATCH] New plugin weather information --- plugins/weather/README.md | 19 +++++++++++++++++++ plugins/weather/weather.plugin.zsh | 12 ++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 plugins/weather/README.md create mode 100644 plugins/weather/weather.plugin.zsh diff --git a/plugins/weather/README.md b/plugins/weather/README.md new file mode 100644 index 00000000..9188d193 --- /dev/null +++ b/plugins/weather/README.md @@ -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. diff --git a/plugins/weather/weather.plugin.zsh b/plugins/weather/weather.plugin.zsh new file mode 100644 index 00000000..98954565 --- /dev/null +++ b/plugins/weather/weather.plugin.zsh @@ -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 +}