summaryrefslogtreecommitdiffstats
path: root/ship
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-14 12:36:46 +0100
committertv <tv@nomic.retiolum>2013-11-14 12:36:46 +0100
commitfaf2e8e5386c29d3a3a39a3d21c6ebd3405adaed (patch)
treeab6b5041da3fd158dc1e2268cbf39f89c8aa60a0 /ship
parent5df9f3a8ff52a11445982a215d89672306f0bccb (diff)
ship punani: actually print usage when missing arg
Diffstat (limited to 'ship')
-rw-r--r--ship/lib/punani12
1 files changed, 9 insertions, 3 deletions
diff --git a/ship/lib/punani b/ship/lib/punani
index 2c48f883..ab9d92a5 100644
--- a/ship/lib/punani
+++ b/ship/lib/punani
@@ -20,14 +20,20 @@ _punani_brew_install(){ brew install "$@"; }
_punani_brew_remove(){ brew remove "$@";}
_punani_brew_has(){ error "not implemented"; return 1 ;}
+_punani_usage='punani {install,remove,has} PACKAGE...'
punani(){
for p in ${KNOWN_PACKERS:-null}; do
exists $p && info "using $p" && PACKER=`echo $p | tr -d -` && break
done || die 'Error 2: no package manager found; no punani for you!'
ACTION="$1"; shift
+
+ if test $# = 0; then
+ error 'no PACKAGE specified.'
+ die "usage: $_punani_usage"
+ fi
+
PKGS="$*"
- [ -z "$PKGS" ] && error "no PACKAGE specified." && ACTION="usage"
for PKG in $PKGS; do
RES="`_punani_resolve_package $PKG`"
@@ -51,8 +57,8 @@ punani(){
fi
;;
*)
- error "usage: punani (install|remove|has) PACKAGE..."
- return 23
+ error "bad action: $ACTION"
+ die "usage: $_punani_usage"
esac
done
}