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:
[email protected]
With regards,
Apache Git Services