You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Crazy Gambler (JIRA)" <ji...@apache.org> on 2016/02/05 19:16:40 UTC

[jira] [Commented] (GROOVY-6754) groovysh positional argument terminates groovysh after evaluation

    [ https://issues.apache.org/jira/browse/GROOVY-6754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15134614#comment-15134614 ] 

Crazy Gambler commented on GROOVY-6754:
---------------------------------------

Updating on the basis of: http://groovy.329449.n5.nabble.com/Groovysh-in-non-interactive-mode-td5731004.html

The changes for this improvement introduced the following regressions: groovysh no longer works in non-interactive mode.

1) Before Groovy 2.4, you could run groovysh in non-interactive mode. It would execute the action and then quit. This made it useful when embedding in shell scripts etc.
2) Before Groovy 2.4, you could pass arguments to groovysh in non-interactive mode. For example, I had some custom commands which I could execute not only from within the shell, but also outside of the shell.

Both these features seem to be gone in latest Groovy 2.4.5 release. They were useful and a lot of code depended on them. 

Before (groovy 2.3.9):
user@machine:~$ groovysh :show all
No variables defined
No classes have been loaded
No custom imports have been defined
Preferences:
    verbose=false
===> [null, null, null, null]
user@machine:~$

After (groovy 2.4.5):
user@machine:~/opt/groovy-2.4.5/bin$ ./groovysh :show all
Groovy Shell (2.4.5, JVM: 1.8.0_51)
Type ':help' or ':h' for help.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
groovy:000> :load :show
File not found: ":show"
groovy:000> :load all
File not found: "all"
groovy:000>

> groovysh positional argument terminates groovysh after evaluation
> -----------------------------------------------------------------
>
>                 Key: GROOVY-6754
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6754
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Groovysh
>            Reporter: Thibault Kruse
>            Assignee: Pascal Schumacher
>            Priority: Minor
>             Fix For: 2.4.0-beta-1
>
>
> groovy can be invoked passing a script via the -e param, e.g.
> {quote}$ groovy -e 'print 1+1'
> 2 {quote}
> groovy can also run a script file that is passed as positional argument:
> {quote}$ groovy foo.groovy
> Hello World{quote}
> For some reason, groovysh has no -e option, but allos passing a script as positional argument. However, when passing this, groovysh evaluates and then shuts down, seemingly without benefit over the groovy -e command.
> Also see this discussion (from 2010): http://groovy.329449.n5.nabble.com/groovy-equivalent-to-quot-python-i-lt-script-py-gt-quot-td372587.html
> So i suggest to make groovysh parameters consistent with the groovy command, but that groovysh does not terminate after evaluation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)