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/08/26 20:25:19 UTC

[12/18] tinkerpop git commit: :remote commands had trouble with the line parsing so made a special case just for GremlinSetCommand

:remote commands had trouble with the line parsing so made a special case just for GremlinSetCommand


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

Branch: refs/heads/master
Commit: bdded27325fc5c10f41ef44f5d422b39b9ccbb51
Parents: 5bd1152
Author: Robert Dale <ro...@gmail.com>
Authored: Sat Aug 20 09:05:07 2016 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Sat Aug 20 09:05:07 2016 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/console/GremlinGroovysh.groovy     | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdded273/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy
index fdf799a..2da0100 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.console
 
+import org.apache.tinkerpop.gremlin.console.commands.GremlinSetCommand
 import org.codehaus.groovy.tools.shell.Command
 import org.codehaus.groovy.tools.shell.Groovysh
 import org.codehaus.groovy.tools.shell.ParseCode
@@ -52,8 +53,14 @@ class GremlinGroovysh extends Groovysh {
         def cmd = registry.find(linetokens[0])
 
         if (cmd != null && linetokens.size() > 1 && parsedArgs != null) {
-            List<String> args = CommandArgumentParser.parseLine(line, parsedArgs == null ? 1 : -1)
-            parsedArgs.addAll(args[1..-1])
+            if (cmd instanceof GremlinSetCommand) {
+                // the following line doesn't play well with :remote scripts because it tokenizes quoted args as single args
+                // but at this point only the set command had trouble with quoted params/args with spaces
+                List<String> args = CommandArgumentParser.parseLine(line, parsedArgs == null ? 1 : -1)
+                parsedArgs.addAll(args[1..-1])
+            } else {
+                parsedArgs.addAll(linetokens[1..-1])
+            }
         }
 
         return cmd