You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/05/18 13:11:16 UTC
[09/16] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/tp31'
Merge remote-tracking branch 'origin/tp31'
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/423285e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/423285e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/423285e3
Branch: refs/heads/TINKERPOP-1274
Commit: 423285e38acc7f8e22b42091c78bc8b0c6ad03d3
Parents: efe0360 0a34d2d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon May 16 08:10:46 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon May 16 08:10:46 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
docs/src/reference/gremlin-applications.asciidoc | 4 ++--
.../tinkerpop/gremlin/console/Console.groovy | 16 +++++++---------
.../tinkerpop/gremlin/console/Mediator.groovy | 4 +---
.../groovy/plugin/DriverRemoteAcceptor.java | 2 +-
.../plugin/DriverRemoteAcceptorIntegrateTest.java | 18 +++++++++---------
.../groovy/plugin/DriverRemoteAcceptorTest.java | 2 +-
7 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/423285e3/CHANGELOG.asciidoc
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/423285e3/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/423285e3/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --cc gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index 564df32,0daf650..91cba82
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@@ -356,59 -303,6 +354,59 @@@ class Console
}
public static void main(final String[] args) {
- new Console(args.length == 1 ? args[0] : null)
+ // need to do some up front processing to try to support "bin/gremlin.sh init.groovy" until this deprecated
+ // feature can be removed. ultimately this should be removed when a breaking change can go in
+ IO io = new IO(System.in, System.out, System.err)
+ if (args.length == 1 && !args[0].startsWith("-"))
+ new Console(io, [args[0]], true)
+
+ final CliBuilder cli = new CliBuilder(usage: 'gremlin.sh [options] [...]', formatter: new HelpFormatter(), stopAtNonOption: false)
+
+ // note that the inclusion of -l is really a setting handled by gremlin.sh and not by Console class itself.
+ // it is mainly listed here for informational purposes when the user starts things up with -h
+ cli.with {
+ h(longOpt: 'help', "Display this help message")
+ v(longOpt: 'version', "Display the version")
+ l("Set the logging level of components that use standard logging output independent of the Console")
+ V(longOpt: 'verbose', "Enable verbose Console output")
+ Q(longOpt: 'quiet', "Suppress superfluous Console output")
+ D(longOpt: 'debug', "Enabled debug Console output")
+ i(longOpt: 'interactive', argName: "SCRIPT ARG1 ARG2 ...", args: Option.UNLIMITED_VALUES, valueSeparator: ' ' as char, "Execute the specified script and leave the console open on completion")
+ e(longOpt: 'execute', argName: "SCRIPT ARG1 ARG2 ...", args: Option.UNLIMITED_VALUES, valueSeparator: ' ' as char, "Execute the specified script (SCRIPT ARG1 ARG2 ...) and close the console on completion")
+ }
+ OptionAccessor options = cli.parse(args)
+
+ if (options == null) {
+ // CliBuilder prints error, but does not exit
+ System.exit(22) // Invalid Args
+ }
+
+ if (options.h) {
+ cli.usage()
+ System.exit(0)
+ }
+
+ if (options.v) {
+ println("gremlin " + Gremlin.version())
+ System.exit(0)
+ }
+
+ if (options.V) io.verbosity = IO.Verbosity.VERBOSE
+ if (options.D) io.verbosity = IO.Verbosity.DEBUG
+ if (options.Q) io.verbosity = IO.Verbosity.QUIET
+
+ // override verbosity if not explicitly set and -e is used
+ if (options.e && (!options.V && !options.D && !options.Q))
+ io.verbosity = IO.Verbosity.QUIET
+
+ if (options.i && options.e) {
+ println("-i and -e options are mutually exclusive - provide one or the other")
+ System.exit(0)
+ }
+
+ List<String> scriptAndArgs = options.e ?
+ (options.es != null && options.es ? options.es : null) :
+ (options.is != null && options.is ? options.is : null)
+ new Console(io, scriptAndArgs, !options.e)
}
- }
+ }