Github user pluradj commented on a diff in the pull request: https://github.com/apache/incubator-tinkerpop/pull/297#discussion_r61726988 --- Diff: gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy --- @@ -284,27 +315,98 @@ class Console { return STANDARD_RESULT_PROMPT } - private void initializeShellWithScript(final String initScriptFile) { + private void executeInShell(final List<String> scriptAndArgs) { + final String scriptFile = scriptAndArgs[0] try { - final File file = new File(initScriptFile) - file.eachLine { line -> + // check if this script comes with arguments. if so then set them up in an "args" bundle + if (scriptAndArgs.size() > 1) { + List<String> args = scriptAndArgs.subList(1, scriptAndArgs.size()) + groovy.execute("args = [\"" + args.join('\",\"') + "\"]") + } --- End diff -- I'm suggesting this ``` if (scriptAndArgs.size() > 1) { List<String> args = scriptAndArgs.subList(1, scriptAndArgs.size()) groovy.execute("args = [\"" + args.join('\",\"') + "\"]") } else { groovy.execute("args = []") } ``` so that this input groovy script ``` println args ``` doesn't fail like this ``` /bin/gremlin.sh -e /tmp/foo.groovy Error in /tmp/foo.groovy at [1: println args] - No such property: args for class: groovysh_evaluate groovy.lang.MissingPropertyException: No such property: args for class: groovysh_evaluate ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---