]> gitweb.fluxo.info Git - scripts.git/commitdiff
Fixing vbox usage
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 13 Jun 2014 20:08:18 +0000 (17:08 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 13 Jun 2014 20:08:18 +0000 (17:08 -0300)
vbox

diff --git a/vbox b/vbox
index cb9dc8566c245749b6359feea2c8f158c10d6c21..42dd8af0375c2e331d33be84c0e935c0038df5af 100755 (executable)
--- a/vbox
+++ b/vbox
@@ -8,6 +8,12 @@ BASENAME="`basename $0`"
 COMMAND="$1"
 VM="$2"
 
+# Usage
+function usage {
+  echo "usage: $BASENAME <command> [vm]"
+  exit 1
+}
+
 # Build options
 if [ ! -z "$VM" ]; then
   if [ "$COMMAND" == "up" ]; then
@@ -19,13 +25,14 @@ if [ ! -z "$VM" ]; then
   elif [ "$COMMAND" == "halt" ]; then
     OPTIONS="poweroff"
     COMMAND="controlvm"
+  else
+    usage
   fi
 elif [ "$COMMAND" == "status" ]; then
   OPTIONS="runningvms"
   COMMAND="list"
 else
-  echo "usage: $BASENAME <command> [vm]"
-  exit 1
+  usage
 fi
 
 # Dispatch