ansiweather

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

commit 539eedbe3b20cbb40a3cdb64beb4cddbe7874671
parent c84067394d35392fa5c8db0deaec49ff1f4b44bc
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Sun, 13 Jul 2014 10:22:36 +0200

Merge pull request #56 from mdom/master

added configurable time and date formats
Diffstat:
Mansiweather | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ansiweather b/ansiweather @@ -89,6 +89,9 @@ forecast=$(get_config "forecast" || echo 0) # Show daylight : "true" or "false" daylight=$(get_config "daylight" || echo false) +dateformat=$(get_config "dateformat" || echo "%a %b %d") +timeformat=$(get_config "timeformat" || echo "%b %d %r") + # Or get config options from command line flags while getopts l:u:s:f:Fd: option do @@ -165,10 +168,10 @@ fi function epoch_to_date { if date -j -r $1 +"%a %b %d" > /dev/null 2>&1; then # BSD - ret=$(date -j -r $1 +"%a %b %d") + ret=$(date -j -r $1 +"$dateformat") else # GNU - ret=$(date -d @$1 +"%a %b %d") + ret=$(date -d @$1 +"$dateformat") fi echo $ret } @@ -226,10 +229,10 @@ fi function epoch_to_time { if date -j -r $1 +"%r" > /dev/null 2>&1; then # BSD - ret=$(date -j -r $1 +"%b %d %r") + ret=$(date -j -r $1 +"$timeformat") else # GNU - ret=$(date -d @$1 +"%b %d %r") + ret=$(date -d @$1 +"$timeformat") fi echo $ret }