diff --git a/mocha-suv/common/libexec/mocha-suv b/mocha-suv/common/libexec/mocha-suv index 54f3902..9c3da1e 100755 --- a/mocha-suv/common/libexec/mocha-suv +++ b/mocha-suv/common/libexec/mocha-suv @@ -192,6 +192,11 @@ elif [ "$1" == "up" ]; then else echo "usage: mocha suv up MACHINENAME" fi + +elif [ "$1" == "show" ]; then + + URL="https://$2.privatesuv.com" + xdg-open "$URL" elif [ "$1" == "down" ]; then @@ -209,7 +214,36 @@ elif [ "$1" == "down" ]; then else - VBoxManage controlvm "mochasuv-$2" poweroff & + EXISTS=$(VBoxManage list vms | grep 'mochasuv-$2') + if [ "$EXISTS" != "" ]; then + + # is VBox VM + VBoxManage controlvm "mochasuv-$2" poweroff & + + else + + EXISTS=$(echo "$LXC_VMS" | grep $2) + if [ "$EXISTS" != "" ]; then + + # LXC container found, start it + lxc stop $2 + + else + + # last chance, maybe we used Docker + EXISTS=$(echo "$DOCKER_VMS_RUNNING" | grep $2) + if [ "$EXISTS" != "" ]; then + + docker container stop $2 + + else + + exit 127 + + fi + + fi + fi fi @@ -291,10 +325,12 @@ elif [ "$1" == "new" ]; then shift; - BACKEND="vagrant" - + BACKEND="docker" + UNATTENDED="0" + while true; do case "$1" in + --unattended ) UNATTENDED="1"; shift ;; -b | --backend ) BACKEND="$2"; shift 2 ;; -- ) shift; break ;; * ) break ;; @@ -331,7 +367,8 @@ elif [ "$1" == "new" ]; then elif [ "$BACKEND" == "docker" ]; then - /usr/lib/mocha/docker/docker-run + cd /usr/lib/mocha/docker + ./docker-run else diff --git a/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv b/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv index bfb79e5..451e1ba 100644 --- a/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv +++ b/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv @@ -20,10 +20,10 @@ _mocha() return 0 ;; suv) - COMPREPLY=( $( compgen -W "new up down delete shell status list" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "new up down show delete shell status list" -- "$cur" ) ) return 0 ;; - up|down|delete|shell|status) + up|down|show|delete|shell|status) COMPREPLY=( $( compgen -W "$(mocha suv list)" -- "$cur" ) ) return 0 ;;