From cbf2f9e3ba66acb8c32f0826a90ea6fd39a349dc Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 27 May 2022 11:27:23 +0200 Subject: lbu: fix usage for top level --- lbu.in | 7 ++++--- tests/lbu_test | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100755 tests/lbu_test diff --git a/lbu.in b/lbu.in index be8c605..6747ded 100644 --- a/lbu.in +++ b/lbu.in @@ -56,7 +56,7 @@ usage() { -q Quiet mode. -v Verbose mode. __EOF__ - exit 1 + exit $1 } cleanup() { @@ -731,7 +731,7 @@ cmd=$(echo "$PROGRAM" | cut -s -d_ -f2) PROGRAM=$(echo "$PROGRAM" | cut -d_ -f1) if [ -z "$cmd" ] ; then cmd="$1" - [ -z "$cmd" ] && usage + [ -z "$cmd" ] && usage "1" >&2 shift fi @@ -747,7 +747,8 @@ case "$cmd" in revert) SUBCMD="revert";; diff) SUBCMD="diff";; migrate_include_exclude) SUBCMD="migrate_include_exclude";; - *) usage;; + -h) usage 0;; + *) usage "1" >&2;; esac # parse common args diff --git a/tests/lbu_test b/tests/lbu_test new file mode 100755 index 0000000..b91205c --- /dev/null +++ b/tests/lbu_test @@ -0,0 +1,10 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/test_env.sh +init_tests \ + lbu_usage + +lbu_usage_body() { + test_usage lbu +} + -- cgit v1.2.3