ansiweather

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

commit 1d7e98a5c0e2e9fb6c00480516e8add46b093b4c
parent c84067394d35392fa5c8db0deaec49ff1f4b44bc
Author: Mario Domgoergen <mdom@taz.de>
Date:   Fri, 13 Jun 2014 16:09:49 +0200

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 }