commit e48dee31112adc24f7d2acd8b6dc01554fbd6a26
parent 9823ab38c560002eccd31e1ab5ebb287a17615b1
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Wed, 19 Aug 2015 23:17:18 +0200
Merge pull request #65 from lucc/help
Improve help message and add -h.
Diffstat:
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -102,7 +102,7 @@ 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:v option
+while getopts l:u:s:f:Fd:h option
do
case "${option}"
in
@@ -112,7 +112,7 @@ do
f) forecast=${OPTARG};;
F) forecast="5";;
d) daylight=${OPTARG};;
- v) usage=true;;
+ h) usage=true;;
esac
done
@@ -122,18 +122,22 @@ done
if [ "$usage" = true ]
then
- echo "\nAnsiWeather 1.02 (c) by Frederic Cambus 2013-2015\n" \
- "\nUSAGE: ansiweather [options]\n" \
- "\nOptions are :\n\n" \
- " -l Specify location\n" \
- " -u Specify unit system to use (metric or imperial)\n" \
- " -s Toggle symbol display\n" \
- " -f Toggle forecast mode for the specified number of upcoming days\n" \
- " -F Toggle forecast mode for the next five days\n" \
- " -d Toggle daylight data display\n" \
- " -v Display usage\n"
-
- echo "EXAMPLES: ansiweather -l Moscow,RU -u metric -s true -f 5 -d true\n"
+ printf "%s\n" \
+ "" \
+ "AnsiWeather 1.02 (c) by Frederic Cambus 2013-2015" \
+ "" \
+ "USAGE: ansiweather [options]" \
+ "" \
+ "Options are :" \
+ "" \
+ " -l Specify location" \
+ " -u Specify unit system to use (metric or imperial)" \
+ " -s Toggle symbol display" \
+ " -f Toggle forecast mode for the specified number of upcoming days" \
+ " -F Toggle forecast mode for the next five days" \
+ " -d Toggle daylight data display" \
+ " -h Display usage" \
+ "EXAMPLES: ansiweather -l Moscow,RU -u metric -s true -f 5 -d true"
exit
fi
@@ -309,7 +313,7 @@ case $units in
speed_unit="mph"
pressure_unit="inHg"
if [ "$forecast" = 0 ]
- then
+ then
pressure=$(printf '%.2f' "$(echo "$pressure*0.0295" | bc)")
fi
;;