[
https://issues.apache.org/jira/browse/TINKERPOP-1268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15266419#comment-15266419
]
ASF GitHub Bot commented on TINKERPOP-1268:
-------------------------------------------
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
```
> Improve script execution options for console
> --------------------------------------------
>
> Key: TINKERPOP-1268
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1268
> Project: TinkerPop
> Issue Type: Improvement
> Components: console
> Affects Versions: 3.1.2-incubating
> Reporter: stephen mallette
> Assignee: stephen mallette
> Labels: breaking
> Fix For: 3.2.1
>
>
> Given the discussion here:
> https://pony-poc.apache.org/thread.html/Zhsn1tow4012xpm
> Implement the following:
> 1. Deprecate support for {{ScriptExecutor}}
> 2. Deprecate support of bin/gremlin.sh init.groovy
> 3. Add support for {{bin/gremlin.sh -i init.groovy}} which does the same
> thing as (2) and does not exit the console on failure. That would allow a
> user to work with their console session up to the point of failure.
> 4. Improve support for {{bin/gremlin.sh -e exec.groovy}} to no longer use
> {{ScriptExecutor}} and execute scripts directly in the console for automation
> purposes.
> 5. Add some other options to control output to the console so that you could
> do {{bin/gremlin.sh -q -e exec.groovy}} which would execute in a quiet mode
> with no output, for example.
> The idea would be to try to implement this without breaking change.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)