diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-10 12:53:50 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-10 12:54:19 +0200 |
commit | 7a8c58e530cea4d2659ad1ef9a6288bbc8fd298c (patch) | |
tree | 8cc8e099f30f7d32fe7b17a9b6780784f446a8c3 | |
parent | 8b1d11508e985cc2cd97a1d70d01574e78109569 (diff) | |
download | app.sh-7a8c58e530cea4d2659ad1ef9a6288bbc8fd298c.tar.gz app.sh-7a8c58e530cea4d2659ad1ef9a6288bbc8fd298c.tar.bz2 app.sh-7a8c58e530cea4d2659ad1ef9a6288bbc8fd298c.tar.xz app.sh-7a8c58e530cea4d2659ad1ef9a6288bbc8fd298c.zip |
o Getting list-versions to work again.
o Allowing -n and -i before the method.
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | app | 60 |
2 files changed, 47 insertions, 17 deletions
@@ -18,6 +18,8 @@ TODOs * Concept: config. group, key and value. * Scriptable +* init.d support + Method Contract --------------- @@ -26,4 +28,4 @@ Method Contract * `APPSH_NAME` * `APPSH_INSTANCE` * `APPSH_METHOD` -* `APPSH_PID_FILE` + @@ -502,12 +502,12 @@ method_list_versions() { mode="parseable" ;; \?) - set_current_usage "Invalid option: -$OPTARG" + list_versions_usage "Invalid option: -$OPTARG" ;; esac done - assert_is_instance set_current_usage "$name" "$instance" + assert_is_instance list_versions_usage "$name" "$instance" "no" if [ $mode = "pretty" ] then @@ -566,6 +566,7 @@ method_set_current() { exit 1 fi + rm -f $BASEDIR/$name/$instance/current ln -s versions/$version/root $BASEDIR/$name/$instance/current return 0 @@ -588,20 +589,47 @@ method_usage() { . $BASEDIR/.app/lib/app-conf -if [ $# -gt 0 ] -then +main() { + local method="" + local first + + while getopts "n:i:" opt + do + case $opt in + n) + name=$OPTARG + first="$first -n $name" + shift + shift + OPTIND=1 + ;; + i) + instance=$OPTARG + first="$first -i $instance" + shift + shift + OPTIND=1 + ;; + \?) + echo "Invalid option: $OPTARG" + ;; + esac + done + method=$1 shift -fi -case "$method" in - conf) method_conf $@ ;; - install) method_install $@ ;; - list) method_list $@ ;; - list-versions) method_list_versions $@ ;; - set-current) method_set_current $@ ;; - start) method_start $@ ;; - stop) method_stop $@ ;; - *) method_usage $@ ;; -esac -exit $? + case "$method" in + conf) method_conf $first $@ ;; + install) method_install $first $@ ;; + list) method_list $first $@ ;; + list-versions) method_list_versions $first $@ ;; + set-current) method_set_current $first $@ ;; + start) method_start $first $@ ;; + stop) method_stop $first $@ ;; + *) method_usage $@ ;; + esac + exit $? +} + +main $@ |