[GitHub] milleruntime commented on a change in pull request #21: Add debug flag to runex Fixes #18

2018-04-11 Thread GitBox
milleruntime commented on a change in pull request #21: Add debug flag to runex 
Fixes #18
URL: https://github.com/apache/accumulo-examples/pull/21#discussion_r180805567
 
 

 ##
 File path: bin/runex
 ##
 @@ -16,10 +16,24 @@
 # limitations under the License.
 
 main_class="$1"
-main_args="${*:2}"
+mvn_opts="-q"
+main_args=()
+
+shift
+while [[ $# -gt 0 ]] ; do
+  case $1 in
+-d|--debug)
+mvn_opts="-X"
+;;
+*)
+main_args+=("$1")
+;;
+  esac
+  shift
+done
 
 if command -v accumulo > /dev/null 2>&1 ; then
   av_arg="-Daccumulo.version=`accumulo version | tail -n 1`"
 fi
 
-mvn -q exec:java -Dlog4j.configuration="file:./conf/log4j.properties" 
-Dexec.mainClass="org.apache.accumulo.examples.$main_class" $av_arg 
-Dexec.args="$main_args"
+mvn $mvn_opts exec:java -Dlog4j.configuration="file:./conf/log4j.properties" 
-Dexec.mainClass="org.apache.accumulo.examples.$main_class" $av_arg 
-Dexec.args="${main_args[@]}"
 
 Review comment:
   It took me a second to wrap my head around this one but thank you for the 
example and explanation.  I wouldn't need to worry about constructing an array 
if I use your idea of the env variable below.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] milleruntime commented on a change in pull request #21: Add debug flag to runex Fixes #18

2018-04-11 Thread GitBox
milleruntime commented on a change in pull request #21: Add debug flag to runex 
Fixes #18
URL: https://github.com/apache/accumulo-examples/pull/21#discussion_r180804911
 
 

 ##
 File path: bin/runex
 ##
 @@ -16,10 +16,24 @@
 # limitations under the License.
 
 main_class="$1"
-main_args="${*:2}"
+mvn_opts="-q"
+main_args=()
+
+shift
+while [[ $# -gt 0 ]] ; do
+  case $1 in
+-d|--debug)
 
 Review comment:
   I like using an environment variable, I think that's the best solution.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services