Github user pluradj commented on a diff in the pull request:
https://github.com/apache/incubator-tinkerpop/pull/297#discussion_r61685928
--- 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 --
Should declare `args` as either `null` or `[]` here if none are passed in,
otherwise a script allowing 0 or more args would hit an error for `args` not
declared.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---