From a596951dba28988ffba066c51eff371c7d10cd81 Mon Sep 17 00:00:00 2001 From: Steve 'Ashcrow' Milner Date: Sat, 8 Aug 2009 20:17:27 -0400 Subject: [PATCH] added --verbose to jython bash script --- jython/src/shell/jython | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/jython/src/shell/jython b/jython/src/shell/jython index ff8df4a..41f145b 100755 --- a/jython/src/shell/jython +++ b/jython/src/shell/jython @@ -12,9 +12,25 @@ # # ----------------------------------------------------------------------------- -cygwin=false +# ----- Allow for script debug mode ------------------------------------------- +# Someone may want to know what this script is doing :-) ... allow --verbose/-v +# Note that this is done way before other options so the user can see the +# results from the start. +JYTHON_SHELL_DEBUG=false +function toggle_debug { + ARGS=$1 + if [[ "$ARGS" =~ "--verbose" ]]; then + if [ $JYTHON_SHELL_DEBUG == false ]; then + set -x && JYTHON_SHELL_DEBUG=true + else + set +x && JYTHON_SHELL_DEBUG=false + fi + fi +} +toggle_debug $@ # ----- Identify OS we are running under -------------------------------------- +cygwin=false case "`uname`" in CYGWIN*) cygwin=true;; Darwin) darwin=true;; @@ -267,6 +283,7 @@ elif [ -n "$help_requested" ] ; then echo "--print : print the Java command instead of executing it" >&2 echo "--profile: run with the Java Interactive Profiler (http://jiprof.sf.net)" >&2 echo "--boot : put jython on the boot classpath (disables the bytecode verifier)" >&2 + echo "--verbose: shows all information on this shell script as it executes" >&2 echo "-- : pass remaining arguments through to Jython" >&2 echo "Jython launcher environment variables:" >&2 echo "JAVA_HOME : Java installation directory" >&2 @@ -277,5 +294,6 @@ fi if $cygwin; then stty icanon echo > /dev/null 2>&1 fi - +# Turn off script debug just incase +toggle_debug $@ exit $JYTHON_STATUS -- 1.6.2.5