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/16 12:36:09 UTC

[1/3] incubator-tinkerpop git commit: Reduced confusion around connection message for :remote

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master efe0360ca -> 423285e38


Reduced confusion around connection message for :remote

When a :remote is executed in the console, the connection is not immediately established (i.e. the server might be down or unavailable) so to say that the console is "Connected" can be misleading if the next command the user issues returns a timeout. CTR


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/1275437f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/1275437f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/1275437f

Branch: refs/heads/master
Commit: 1275437f266becbb0c2e3027905efc2d83bafda1
Parents: c2ca115
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 12 07:51:48 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 12 08:26:09 2016 -0400

----------------------------------------------------------------------
 docs/src/reference/gremlin-applications.asciidoc  |  4 ++--
 .../groovy/plugin/DriverRemoteAcceptor.java       |  2 +-
 .../plugin/DriverRemoteAcceptorIntegrateTest.java | 18 +++++++++---------
 .../groovy/plugin/DriverRemoteAcceptorTest.java   |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1275437f/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index a894335..72a5515 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -1025,7 +1025,7 @@ the thread continuously:
 
 [source,groovy]
 gremlin> :remote connect tinkerpop.server conf/remote.yaml
-==>Connected - localhost/127.0.0.1:8182
+==>Configured localhost/127.0.0.1:8182
 gremlin> :> while(true) { }
 Execution timed out after 10000 units. Start time: Fri Jul 24 11:04:52 EDT 2015
 
@@ -1430,7 +1430,7 @@ one command and then expect to access it in the next:
 [source,groovy]
 ----
 gremlin> :remote connect tinkerpop.server conf/remote.yaml
-==>Connected - localhost/127.0.0.1:8182
+==>Configured localhost/127.0.0.1:8182
 gremlin> :> x = 2
 ==>2
 gremlin> :> 2 + x

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1275437f/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
index 5a0f6ef..f34827e 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
@@ -95,7 +95,7 @@ public class DriverRemoteAcceptor implements RemoteAcceptor {
                 this.currentClient = this.currentCluster.connect();
             }
             this.currentClient.init();
-            return String.format("Connected - %s", this.currentCluster) + getSessionStringSegment();
+            return String.format("Configured %s", this.currentCluster) + getSessionStringSegment();
         } catch (final FileNotFoundException ignored) {
             throw new RemoteException("The 'connect' option must be accompanied by a valid configuration file");
         } catch (final Exception ex) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1275437f/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
index 22a9d32..f4d4b5d 100644
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
@@ -81,12 +81,12 @@ public class DriverRemoteAcceptorIntegrateTest extends AbstractGremlinServerInte
 
     @Test
     public void shouldConnect() throws Exception {
-        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
     }
 
     @Test
     public void shouldConnectAndSubmitSession() throws Exception {
-        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath(), "session")).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath(), "session")).toString(), startsWith("Configured "));
         assertEquals("1", ((Iterator) acceptor.submit(Collections.singletonList("x = 1"))).next());
         assertEquals("0", ((Iterator) acceptor.submit(Collections.singletonList("x - 1"))).next());
         assertEquals("0", ((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).iterator().next().getString());
@@ -94,28 +94,28 @@ public class DriverRemoteAcceptorIntegrateTest extends AbstractGremlinServerInte
 
     @Test
     public void shouldConnectAndSubmitSimple() throws Exception {
-        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
         assertEquals("2", ((Iterator) acceptor.submit(Collections.singletonList("1+1"))).next());
         assertEquals("2", ((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).iterator().next().getString());
     }
 
     @Test
     public void shouldConnectAndSubmitSimpleList() throws Exception {
-        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
         assertThat(IteratorUtils.list(((Iterator<String>) acceptor.submit(Collections.singletonList("[1,2,3,4,5]")))), contains("1", "2", "3", "4", "5"));
         assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), contains("1", "2", "3", "4", "5"));
     }
 
     @Test
     public void shouldConnectAndReturnVertices() throws Exception {
-        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
         assertThat(IteratorUtils.list(((Iterator<String>) acceptor.submit(Collections.singletonList("g.addVertex('name','stephen');g.addVertex('name','marko');g.traversal().V()")))), hasSize(2));
         assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), hasSize(2));
     }
 
     @Test
     public void shouldConnectAndReturnVerticesWithAnAlias() throws Exception {
-        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
         acceptor.configure(Arrays.asList("alias", "x", "g"));
         assertThat(IteratorUtils.list(((Iterator<String>) acceptor.submit(Collections.singletonList("x.addVertex('name','stephen');x.addVertex('name','marko');x.traversal().V()")))), hasSize(2));
         assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), hasSize(2));
@@ -123,14 +123,14 @@ public class DriverRemoteAcceptorIntegrateTest extends AbstractGremlinServerInte
 
     @Test
     public void shouldConnectAndSubmitForNull() throws Exception {
-        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Collections.singletonList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
         assertThat(IteratorUtils.list(((Iterator<String>) acceptor.submit(Collections.singletonList("g.traversal().V().drop().iterate();null")))), contains("null"));
         assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getObject).collect(Collectors.toList()), contains("null"));
     }
 
     @Test
     public void shouldConnectAndSubmitInSession() throws Exception {
-        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath(), "session")).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath(), "session")).toString(), startsWith("Configured "));
         assertEquals("2", ((Iterator) acceptor.submit(Collections.singletonList("x=1+1"))).next());
         assertEquals("2", ((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).iterator().next().getString());
         assertEquals("4", ((Iterator) acceptor.submit(Collections.singletonList("x+2"))).next());
@@ -139,7 +139,7 @@ public class DriverRemoteAcceptorIntegrateTest extends AbstractGremlinServerInte
 
     @Test
     public void shouldConnectAndSubmitInNamedSession() throws Exception {
-        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath(), "session", "AAA")).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath(), "session", "AAA")).toString(), startsWith("Configured "));
         assertEquals("2", ((Iterator) acceptor.submit(Collections.singletonList("x=1+1"))).next());
         assertEquals("2", ((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).iterator().next().getString());
         assertEquals("4", ((Iterator) acceptor.submit(Collections.singletonList("x+2"))).next());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1275437f/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
index 4bac249..ef2a0c6 100644
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
@@ -135,6 +135,6 @@ public class DriverRemoteAcceptorTest {
     public void shouldConnect() throws Exception {
         // there is no gremlin server running for this test, but gremlin-driver lazily connects so this should
         // be ok to just validate that a connection is created
-        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+        assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Configured "));
     }
 }


[2/3] incubator-tinkerpop git commit: TINKERPOP-1302 Added shutdown hook to close open remotes.

Posted by sp...@apache.org.
TINKERPOP-1302 Added shutdown hook to close open remotes.

Console mediator close doesn't need a Future. Not sure what was going on here (maybe incomplete??), but there was no need to return a CompletableFuture from Mediator.close() as the close was synchronous. It's also probably not a good idea to leave remotes open as they can leak remote resources. Change to a straight synchronous approach. CTR


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/0a34d2dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/0a34d2dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/0a34d2dd

Branch: refs/heads/master
Commit: 0a34d2ddee45159ea258fbf20a258b4e5a82b0bd
Parents: 1275437
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon May 16 07:30:53 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon May 16 08:10:00 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                    |  1 +
 .../apache/tinkerpop/gremlin/console/Console.groovy   | 14 ++++++--------
 .../apache/tinkerpop/gremlin/console/Mediator.groovy  |  4 +---
 3 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0a34d2dd/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 7fb58fa..1e33187 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -29,6 +29,7 @@ TinkerPop 3.1.3 (NOT OFFICIALLY RELEASED YET)
 * Fixed a bug in `BulkSet.equals()` which made itself apparent when using `store()` and `aggregate()` with labeled `cap()`.
 * Ensured that all asserts of vertex and edge counts were being applied properly in the test suite.
 * Fixed bug in `gremlin-driver` where certain channel-level errors would not allow the driver to reconnect.
+* Use of `Ctrl-C` in Gremlin Console now triggers closing of open remotes.
 * Bumped SLF4J to 1.7.21 as previous versions suffered from a memory leak.
 * Fixed a bug in `Neo4jGraphStepStrategy` where it wasn't defined properly as a `ProviderOptimizationStrategy`.
 * Renamed `AndTest.get_g_V_andXhasXage_gt_27X__outE_count_gt_2X_name` to `get_g_V_andXhasXage_gt_27X__outE_count_gte_2X_name` to match the traversal being tested.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0a34d2dd/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git 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
index a13e785..0daf650 100644
--- 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
@@ -34,7 +34,6 @@ import org.codehaus.groovy.tools.shell.util.Preferences
 import org.fusesource.jansi.Ansi
 import org.fusesource.jansi.AnsiConsole
 
-import java.util.concurrent.TimeUnit
 import java.util.prefs.PreferenceChangeEvent
 import java.util.prefs.PreferenceChangeListener
 
@@ -87,6 +86,10 @@ class Console {
         })
 
         final Mediator mediator = new Mediator(this)
+
+        // make sure that remotes are closed if console takes a ctrl-c
+        addShutdownHook { mediator.close() }
+
         groovy = new GremlinGroovysh(mediator)
 
         def commandsToRemove = groovy.getRegistry().commands().findAll{it instanceof SetCommand}
@@ -150,13 +153,8 @@ class Console {
         } catch (Throwable t) {
             t.printStackTrace()
         } finally {
-            try {
-                mediator.close().get(3, TimeUnit.SECONDS)
-            } catch (Exception ignored) {
-                // ok if this times out - just trying to be polite on shutdown
-            } finally {
-                System.exit(0)
-            }
+            // shutdown hook defined above will kill any open remotes
+            System.exit(0)
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0a34d2dd/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
index a1235fa..047e3d7 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
@@ -93,7 +93,7 @@ class Mediator {
         return file.exists() ? file.readLines() : []
     }
 
-    def CompletableFuture<Void> close() {
+    def void close() {
         remotes.each { remote ->
             try {
                 remote.close()
@@ -101,8 +101,6 @@ class Mediator {
 
             }
         }
-
-        return CompletableFuture.completedFuture(null)
     }
 
 }


[3/3] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/tp31'

Posted by sp...@apache.org.
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/master
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)
      }
- }
+ }