diff options
Diffstat (limited to '.app')
-rw-r--r-- | .app/lib/app-app | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/.app/lib/app-app b/.app/lib/app-app index 073a8ba..0be0bb5 100644 --- a/.app/lib/app-app +++ b/.app/lib/app-app @@ -74,8 +74,8 @@ method_install_usage() { } method_install() { - local name="$1" - local instance="$2" + local name="$1"; shift + local instance="$2"; shift local version local resolver local url @@ -83,7 +83,10 @@ method_install() { local artifactId local zip_file - shift 2 + if [ $# -eq 0 ] + then + method_install_usage + fi while getopts "n:i:v:r:u:" opt do @@ -109,6 +112,16 @@ method_install() { esac done + if [ -z "$resolver" ] + then + method_install_usage "Missing required option: -r resolver" + fi + + if [ -z "$url" ] + then + method_install_usage "Missing required option: -u url" + fi + case "$resolver" in maven) url=`echo $url | tr ":" " "`; set -- $url @@ -233,10 +246,15 @@ method_set_current_usage() { } method_set_current() { - local name - local instance + local name="$1"; shift + local instance="$2"; shift local version + if [ $# -eq 0 ] + then + method_set_current_usage + fi + while getopts "n:i:v:" opt do case $opt in @@ -292,6 +310,8 @@ method_list_usage() { } method_list() { + local filter_name="$1"; shift + local instance="$2"; shift local mode="pretty" local vars local filter_name @@ -336,16 +356,21 @@ method_list_versions_usage() { fi echo "usage: list-versions -n name -i instance [-P]" >&2 - echo " -P - parseable output" >&2 + echo " -P - parsable output" >&2 exit 1 } method_list_versions() { - local name - local instance + local filter_name="$1"; shift + local instance="$2"; shift local version local mode="pretty" + if [ $# -eq 0 ] + then + method_list_versions_usage + fi + while getopts "n:i:P" opt do case $opt in @@ -400,7 +425,7 @@ method_app() { shift 2 - if [ $# -gt 2 ] + if [ $# -gt 0 ] then method=$1 shift @@ -411,7 +436,7 @@ method_app() { list) method_list "$name" "$instance" "$@" ;; list-versions) method_list_versions "$name" "$instance" "$@" ;; set-current) method_set_current "$name" "$instance" "$@" ;; - *) method_app_usage ;; + *) method_app_usage "Unknown method $method" ;; esac exit $? } |