add -h/--help parameter on all scripts
Benjamin Renard

Benjamin Renard commited on 2012-03-22 16:56:43
Showing 2 changed files, with 3 additions and 5 deletions.

... ...
@@ -13,9 +13,7 @@ function usage() {
13 13
 	[ -n "$1" ] && exit 1 || exit 0
14 14
 }
15 15
 
16
-[ "$TYPE" == "-h" -o "$TYPE" == "--help" ] && usage
17
-
18
-[ ! -n "$TYPE" ] && TYPE=full
16
+[ ! -n "$TYPE" -o "$TYPE" == "-h" -o "$TYPE" == "--help" ] && TYPE=full
19 17
 
20 18
 if [ "$TYPE" == "incr" -o "$TYPE" == "INCR" ]
21 19
 then
... ...
@@ -10,11 +10,11 @@ DEBUG=0
10 10
 
11 11
 function usage() {
12 12
 	[ -n "$1" ] && echo "[ERROR] $1" > /dev/stderr && echo
13
-	echo "usage : $0 [MACHINE] [incr|FULL] [-d]"
13
+	echo "usage : $0 [-h|--help] [MACHINE] [incr|FULL] [-d]"
14 14
 	[ -n "$1" ] && exit 1 || exit 0
15 15
 }
16 16
 
17
-[ ! -n "$MACHINE" ] && usage
17
+[ ! -n "$MACHINE" -o "$MACHINE" == "-h" -o "$MACHINE" == "--help" ] && usage
18 18
 
19 19
 [ ! -n "$TYPE" ] && TYPE=full
20 20
 
21 21