Fix run.sh arguments 69/7669/1
authorVictor Morales <victor.morales@intel.com>
Tue, 15 Aug 2017 23:12:12 +0000 (18:12 -0500)
committerVictor Morales <victor.morales@intel.com>
Tue, 15 Aug 2017 23:12:12 +0000 (18:12 -0500)
The run.sh script had some issues to process the arguments into a
specific order.

Change-Id: I9c10bbf9aa10e133bfdecc67eb013c839039bc90
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-Id: INT-97

bootstrap/vagrant-onap/CONTRIBUTING.md
bootstrap/vagrant-onap/tools/run.sh

index f11327f..7341a10 100644 (file)
@@ -15,7 +15,7 @@ implementation of the _functions_ created on **_lib_** folder.  In order to
 display the Usage information you must execute the script with question mark as
 an argument like follows:
 
-    $ ./tools/run.sh -?
+    $ ./tools/run.sh
 
 or using PowerShell
 
index 6ba4a10..cf31fe4 100755 (executable)
@@ -1,14 +1,11 @@
 #!/bin/bash
 
-usage ()
-{
-cat <<EOF
-Usage: run.sh [-y] [-?] Command
+function usage {
+    cat <<EOF
+Usage: run.sh Command [-y] [-?]
 Optional arguments:
     -y
         Skips warning prompt.
-    -?
-        Shows help about this program.
     -s <suite>
         Test suite to use in testing mode.
     -c <case>
@@ -24,9 +21,9 @@ run=false
 test_suite="*"
 test_case="*"
 
-COMMAND=${@: -1}
+COMMAND=$1
 
-while getopts "y?s:c:" OPTION; do
+while getopts "ys:c:" OPTION "${@:2}"; do
     case "$OPTION" in
     y)
         run=true
@@ -47,9 +44,9 @@ while getopts "y?s:c:" OPTION; do
         fi
         test_case=$OPTARG
         ;;
-    ?)
+    \?)
         usage
-        exit 0
+        exit 1
         ;;
     esac
 done