summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-27 11:27:23 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-06-28 18:23:25 +0200
commitcbf2f9e3ba66acb8c32f0826a90ea6fd39a349dc (patch)
tree98e169db8ef3824fb7bb3791a06c5053c37a6ef6
parente60cf99b0a24412222614746487d31b8f45a520b (diff)
downloadalpine-conf-cbf2f9e3ba66acb8c32f0826a90ea6fd39a349dc.zip
lbu: fix usage for top level
-rw-r--r--lbu.in7
-rwxr-xr-xtests/lbu_test10
2 files changed, 14 insertions, 3 deletions
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
+}
+