diff options
-rw-r--r-- | .app/lib/app-app | 45 | ||||
-rwxr-xr-x | app | 1 | ||||
-rw-r--r-- | docs/README.md | 2 |
3 files changed, 38 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 $? } @@ -23,6 +23,7 @@ method_usage() { echo "Run $0 -h <group> for more help" >&2 } +. $BASEDIR/.app/lib/app-common . $BASEDIR/.app/lib/app-app . $BASEDIR/.app/lib/app-conf . $BASEDIR/.app/lib/app-operate diff --git a/docs/README.md b/docs/README.md index 7e2a5f6..8845059 100644 --- a/docs/README.md +++ b/docs/README.md @@ -35,6 +35,8 @@ TODOs * init.d support +* Support -h for all applicable methods to show the help/usage. + Commands -------- |