[PATCH aiaiai 1/2] aiaiai: use fail_usage on incorrect number of arguments

Jacob Keller jacob.e.keller at intel.com
Fri Mar 28 09:08:31 PDT 2014


We should display the full usage with an error message when we have an
incorrect number of arguments, rather than just die. The advantage is
that the user will see what the actual usage of the program is, rather
than just a somewhat cryptic error message.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
 aiaiai-test-patchset                 | 2 +-
 email/aiaiai-email-dispatcher        | 2 +-
 email/aiaiai-email-dispatcher-helper | 2 +-
 email/aiaiai-email-lda               | 2 +-
 email/aiaiai-email-test-patchset     | 2 +-
 gerrit/aiaiai-jenkins-test-patchset  | 2 +-
 helpers/aiaiai-diff-log              | 2 +-
 helpers/aiaiai-make-kernel           | 2 +-
 helpers/aiaiai-match-keywords        | 2 +-
 helpers/aiaiai-test-bisectability    | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/aiaiai-test-patchset b/aiaiai-test-patchset
index 224c70c681a4..7bf14139d078 100755
--- a/aiaiai-test-patchset
+++ b/aiaiai-test-patchset
@@ -341,7 +341,7 @@ while true; do
 	shift
 done
 
-[ "$#" -ge 2 ] || die "Insufficient arguments"
+[ "$#" -ge 2 ] || fail_usage "Insufficient arguments"
 
 kernel_tree="$(readlink -ev -- "$1")"; shift
 defconfigs="$@"
diff --git a/email/aiaiai-email-dispatcher b/email/aiaiai-email-dispatcher
index caf66a88dcf7..e80aea39e408 100755
--- a/email/aiaiai-email-dispatcher
+++ b/email/aiaiai-email-dispatcher
@@ -116,7 +116,7 @@ while true; do
 	shift
 done
 
-[ "$#" -eq 2 ] || die "Insufficient or too many arguments"
+[ "$#" -eq 2 ] || fail_usage "Insufficient or too many arguments"
 
 program_required "inotifywait" ""
 
diff --git a/email/aiaiai-email-dispatcher-helper b/email/aiaiai-email-dispatcher-helper
index 9558b7799452..36d03a39c4d3 100755
--- a/email/aiaiai-email-dispatcher-helper
+++ b/email/aiaiai-email-dispatcher-helper
@@ -84,7 +84,7 @@ while true; do
 	shift
 done
 
-[ "$#" -eq 4 ] || die "Insufficient or too many arguments"
+[ "$#" -eq 4 ] || fail_usage "Insufficient or too many arguments"
 
 mbox="$(readlink -fv -- "$1")"; shift
 fail_file="$1"; shift
diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda
index 8d65ae2d7f8c..8005e2e893d7 100755
--- a/email/aiaiai-email-lda
+++ b/email/aiaiai-email-lda
@@ -487,7 +487,7 @@ while true; do
 	shift
 done
 
-[ "$#" -eq 2 ] || die "Insufficient or too many arguments"
+[ "$#" -eq 2 ] || fail_usage "Insufficient or too many arguments"
 
 program_required "mutt" ""
 program_required "find" ""
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index 1570dbad8142..f8bcd800a93c 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -227,7 +227,7 @@ while true; do
 	shift
 done
 
-[ "$#" -eq 1 ] || die "Insufficient or too many arguments"
+[ "$#" -eq 1 ] || fail_usage "Insufficient or too many arguments"
 
 program_required "mutt" ""
 program_required "grep" ""
diff --git a/gerrit/aiaiai-jenkins-test-patchset b/gerrit/aiaiai-jenkins-test-patchset
index 629bfcb800a8..e94eacbe8fe6 100755
--- a/gerrit/aiaiai-jenkins-test-patchset
+++ b/gerrit/aiaiai-jenkins-test-patchset
@@ -181,7 +181,7 @@ while true; do
 	shift
 done
 
-[ "$#" -ge 4 ] || die "Insufficient arguments"
+[ "$#" -ge 4 ] || fail_usage "Insufficient arguments"
 
 [ -n "$tmpdir" ] || tmpdir="$(mktemp -dt "$PROG.XXXX")"
 
diff --git a/helpers/aiaiai-diff-log b/helpers/aiaiai-diff-log
index c7a572aafc5f..e5d346fce1aa 100755
--- a/helpers/aiaiai-diff-log
+++ b/helpers/aiaiai-diff-log
@@ -165,7 +165,7 @@ while true; do
 	shift
 done
 
-[ "$#" = 3 ] || die "Insufficient or too many arguments"
+[ "$#" = 3 ] || fail_usage "Insufficient or too many arguments"
 
 
 compile_helpers "$srcdir"
diff --git a/helpers/aiaiai-make-kernel b/helpers/aiaiai-make-kernel
index 4f438900e0b4..934d88b24b94 100755
--- a/helpers/aiaiai-make-kernel
+++ b/helpers/aiaiai-make-kernel
@@ -233,7 +233,7 @@ while true; do
 	shift
 done
 
-[ "$#" -ge 2 ] || die "Insufficient arguments"
+[ "$#" -ge 2 ] || fail_usage "Insufficient arguments"
 
 compile_helpers "$srcdir"
 
diff --git a/helpers/aiaiai-match-keywords b/helpers/aiaiai-match-keywords
index f316792469ed..54af7c5974a0 100755
--- a/helpers/aiaiai-match-keywords
+++ b/helpers/aiaiai-match-keywords
@@ -85,7 +85,7 @@ while true; do
 	shift
 done
 
-[ "$#" -eq 1 ] || die "Please, specify exactly one argument - the file with keywords"
+[ "$#" -eq 1 ] || fail_usage "Please, specify exactly one argument - the file with keywords"
 file="$(readlink -ev -- "$1")"
 
 while IFS= read -r kw; do
diff --git a/helpers/aiaiai-test-bisectability b/helpers/aiaiai-test-bisectability
index 948a8074f8d3..66d5cc57918e 100755
--- a/helpers/aiaiai-test-bisectability
+++ b/helpers/aiaiai-test-bisectability
@@ -190,7 +190,7 @@ while true; do
 	shift
 done
 
-[ "$#" -eq 2 ] || die "Please, specify exactly 2 arguments - the kernel tree and the configuration"
+[ "$#" -eq 2 ] || fail_usage "Please, specify exactly 2 arguments - the kernel tree and the configuration"
 
 kernel_tree="$(readlink -ev -- "$1")"; shift
 defconfig_orig="$1"
-- 
1.8.3.1




More information about the aiaiai mailing list