ansiweather

Weather in terminal, with ANSI colors and Unicode symbols
Log | Files | Refs | README | LICENSE

commit 2e5675561957a507c0f7136bd3b0b596ff6413fc
parent fba3cdbefb3e2ae5a512e7ddf43426788f1918ba
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Thu,  7 May 2015 19:51:11 +0200

Variables name harmonization + documenting 'geo_api_proto' and 'geo_api_url'

Diffstat:
MREADME.md | 13+++++++------
Mansiweather | 18+++++++++---------
Mansiweatherrc.example | 4++++
3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md @@ -11,7 +11,7 @@ Weather data comes from the `OpenWeatherMap` free weather API. ## Requirements -AnsiWeather requires the following dependencies : +AnsiWeather requires the following dependencies : - A command to fetch HTTP data such as [cURL](http://curl.haxx.se) or [wget](https://www.gnu.org/software/wget/) - [jq](http://stedolan.github.io/jq/) (lightweight and flexible command-line JSON processor) @@ -29,7 +29,7 @@ After cloning the repository, simply invoke the script by typing : ## Command Line Options -Any configuration options may also be passed in as command line options. +Any configuration options may also be passed in as command line options : ./ansiweather -l Moscow,RU -u metric -s true -f 5 -d true @@ -40,13 +40,14 @@ Any configuration options may also be passed in as command line options. The following configuration options (detailed below) are available and should be set according to your location and preferences. -Config options can also be set in ~/.ansiweatherrc +Config options can also be set in ~/.ansiweatherrc : Example : `~/.ansiweatherrc` location:Moscow,RU fetch_cmd:ftp -V -o - geo_api_url:www.telize.com/geoip + geo_api_proto:http units:metric daylight:true @@ -128,10 +129,10 @@ Default : `%b %d %r` ### GeoIP URL -Set the url for getting GeoIP data (must return json). +Set the URL for getting GeoIP data (must return JSON) : - geo_api_url:www.telize.com/geoip - geo_api_proto:https + geo_api_url:www.telize.com/geoip + geo_api_proto:http Default : `http://www.telize.com/geoip` diff --git a/ansiweather b/ansiweather @@ -6,7 +6,7 @@ # https://github.com/fcambus/ansiweather # # # # Created: 2013/08/29 # -# Last Updated: 2015/03/16 # +# Last Updated: 2015/05/07 # # # # AnsiWeather is released under the BSD 3-Clause license. # # See LICENSE file for details. # @@ -25,7 +25,7 @@ function get_config { ret="" if [ -f $config_file ] then - ret=$(grep "^$1:" $config_file | awk -F: '{print $2}') + ret=$(grep "^$1:" $config_file | awk -F: '{print $2}') fi if [ "X$ret" = "X" ] @@ -44,23 +44,23 @@ fetch_cmd=$(get_config "fetch_cmd" || echo "curl -s") jqpath="`which jq`" if [ "$jqpath" == "" ] -then +then echo -e "\njq binary is not found, please download it from http://stedolan.github.io/jq/ and put it in your PATH" exit 255 -fi +fi ###[ Auto-Location Logic ]#################################################### -geo_locate_proto=$(get_config "geo_api_proto" || echo "http") -geo_locate_api=$(get_config "geo_api_url" || echo "www.telize.com/geoip") #geo location service -geo_locate_api="${geo_locate_proto}://${geo_locate_api}" +geo_api_proto=$(get_config "geo_api_proto" || echo "http") +geo_api_url=$(get_config "geo_api_url" || echo "www.telize.com/geoip") #geo location service +geo_api="${geo_api_proto}://${geo_api_url}" function auto_locate { ret="" - geo_data=$($fetch_cmd $geo_locate_api) + geo_data=$($fetch_cmd $geo_api) city=$(echo $geo_data | jq -r '.city') @@ -341,7 +341,7 @@ function get_icon { if [ $forecast != 0 ] then output="$background$text $city forecast $text$delimiter " - + i=0 while [ $i -lt $forecast ] do diff --git a/ansiweatherrc.example b/ansiweatherrc.example @@ -9,6 +9,10 @@ daylight:true dateformat:%a %b %d timeformat:%b %d %r +# Geolocation +geo_api_proto:http +geo_api_url:www.telize.com/geoip + # Text and Colors background:\033[44m text:\033[36;1m