From: Jacob Keller Date: Fri, 28 Mar 2014 16:08:31 +0000 (-0700) Subject: aiaiai: use fail_usage on incorrect number of arguments X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c33e515121b5e8945e9e845bd1336482067b8694;p=users%2Fdedekind%2Faiaiai.git aiaiai: use fail_usage on incorrect number of arguments 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 Signed-off-by: Artem Bityutskiy --- diff --git a/aiaiai-test-patchset b/aiaiai-test-patchset index 224c70c..7bf1413 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 caf66a8..e80aea3 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 9558b77..36d03a3 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 8d65ae2..8005e2e 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 9d2d05a..0376957 100755 --- a/email/aiaiai-email-test-patchset +++ b/email/aiaiai-email-test-patchset @@ -223,7 +223,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 629bfcb..e94eacb 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 c7a572a..e5d346f 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 4f43890..934d88b 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 f316792..54af7c5 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 948a807..66d5cc5 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"