]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
email-hook: remove options that can't be used
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 31 Mar 2014 22:24:00 +0000 (15:24 -0700)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 3 Apr 2014 08:21:04 +0000 (11:21 +0300)
Hooks don't really support options, so just remove them. Also, use
fail_usage instead of die for the exit message, so that we actually show
the usage when wrong number of arguments is given.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
email/aiaiai-email-autodetect-project

index cba33f7d6631a406910452b5f0a0c5838eae75f7..7be707b304b44caa755b1d8954fdacb941ec957c 100755 (executable)
@@ -35,10 +35,6 @@ apply. It depends on git-find-base which is included in the helpers folder.
 
 <cfgfile.ini>          - the configuration file.
 <mbox>                 - the mbox file containing the patch series
-
-Options:
-  -v, --verbose          be verbose;
-  -h, --help             show this text and exit.
 EOF
 }
 
@@ -49,7 +45,7 @@ fail_usage()
        exit 1
 }
 
-verbose=
+verbose=-v
 tmpdir=
 cleanup_handler()
 {
@@ -62,27 +58,7 @@ cleanup_handler()
 }
 set_cleanup_handler cleanup_handler
 
-TEMP=`getopt -n $PROG -o i:,C:,p,v,h --long input:,verbose,help -- "$@"` ||
-       fail_usage ""
-eval set -- "$TEMP"
-
-while true; do
-       case "$1" in
-       -v|--verbose) verbose=-v
-               ;;
-       -h|--help)
-               show_usage
-               exit 0
-               ;;
-       --) shift; break
-                ;;
-       *) fail_usage "Unrecognized option: $1"
-               ;;
-       esac
-       shift
-done
-
-[ "$#" -eq 2 ] || die "Insufficient or too many arguments"
+[ "$#" -eq 2 ] || fail_usage "Insufficient or too many arguments"
 
 cfgfile="$(readlink -fv -- "$1")"; shift
 mbox="$(readlink -fv -- "$1")"; shift