From faf2e8e5386c29d3a3a39a3d21c6ebd3405adaed Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 14 Nov 2013 12:36:46 +0100 Subject: ship punani: actually print usage when missing arg --- ship/lib/punani | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ship') 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 } -- cgit v1.2.3