summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lbu.in8
-rwxr-xr-xtests/lbu_test20
2 files changed, 23 insertions, 5 deletions
diff --git a/lbu.in b/lbu.in
index 6747ded..ee9c360 100644
--- a/lbu.in
+++ b/lbu.in
@@ -232,18 +232,18 @@ usage_include() {
-r Remove specified file(s) from include list instead of adding.
-v Verbose mode.
__EOF__
- exit 1
+ exit $1
}
cmd_include() {
cmd_migrate_include_exclude
if [ "$LIST" ] ; then
- [ $# -gt 0 ] && usage_include
+ [ $# -gt 0 ] && usage_include "1" >&2
show_include
return
fi
- [ $# -lt 1 ] && usage_include
+ [ $# -lt 1 ] && usage_include "1" >&2
if [ "$REMOVE" ] ; then
list_delete + "$@"
else
@@ -761,7 +761,7 @@ while getopts "adehlM:np:qrv" opt ; do
;;
e) [ -z "$ENCRYPTION" ] && ENCRYPTION="$DEFAULT_CIPHER"
;;
- h) usage_$SUBCMD
+ h) usage_$SUBCMD 0
;;
l) LIST="-l"
;;
diff --git a/tests/lbu_test b/tests/lbu_test
index b91205c..f393b86 100755
--- a/tests/lbu_test
+++ b/tests/lbu_test
@@ -2,9 +2,27 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
- lbu_usage
+ lbu_usage \
+ lbu_include_usage \
+ lbu_inc_usage \
+ lbu_add_usage
lbu_usage_body() {
test_usage lbu
}
+lbu_include_usage_body() {
+ test_usage "lbu include"
+}
+
+lbu_inc_usage_body() {
+ test_usage "lbu inc"
+}
+
+lbu_add_usage_body() {
+ init_env
+ atf_check -s exit:0 \
+ -o match:"usage: lbu include" \
+ -e empty \
+ lbu add -h
+}