Hitting [ENTER] on the CLI with no text entered reruns the last successful script #138

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants

Hitting [ENTER] on the CLI with no text entered reruns the last successful script

The above is the previous behaviour on grails 1.3.7.

It saves keystrokes especially when the last script run is something like: test-app -unit

@antony antony commented on an outdated diff Dec 18, 2011

.../groovy/grails/cli/interactive/InteractiveMode.groovy
@@ -97,6 +97,9 @@ class InteractiveMode {
addStatus("Enter a script name to run. Use TAB for completion: ")
while (interactiveModeActive) {
def scriptName = showPrompt()
+ if(!scriptName.trim() && lastScriptName){
+ scriptName = lastScriptName
+ }
try {
def trimmed = scriptName.trim()
@antony

antony Dec 18, 2011

You're trimming the script name twice here which is unnecessary. Perhaps set a variable above this statement called 'trimmed' and remove line 104?

thanks for the comment. made some adjustments to remove unnecessary trim() call

Is this really the behaviour we would expect from an interactive shell?
Usually when you hit return in any shell, it simply opens a new line...

antony commented Dec 25, 2011

That's the behaviour I would expect too Marco.
Perhaps a bash-like "!" syntax should repeat the last command.

Yep, letting "!" repeat the last command entered (successful or not) sounds sensible to me too.

This is one keystroke too many if you ask me. It's no different from hitting the [UP] key to bring up the previous command then hitting [ENTER]

antony commented Jan 4, 2012

Which I believe should also be the case.

Once the code is sane again I'd love to help implement a full command set
for the console, if folk are interested.
On Jan 4, 2012 10:34 AM, "Jessie Evangelista" <
reply@reply.github.com>
wrote:

This is one keystroke too many if you ask me. It's no different from
hitting the [UP] key to bring up the previous command then hitting [ENTER]


Reply to this email directly or view it on GitHub:
#138 (comment)

marc0der commented Jan 4, 2012

Don't know if you both spend a lot of time on the command line, but no console that I'm aware of has this behaviour.
Hitting enter always opens a new line on a shell. Be it bash, ksh, dos, groovysh or even the roo shell.

It might be argued what the command to repeat should be (we've gone for !), but I still don't think that simply hitting enter to repeat is a sensible default. Bash uses !!, which is probably the better option.

antony commented Jan 4, 2012

I'm not agreeing to enter to repeat, i'm agreeing that up to navigate
console history is desirable.
On Jan 4, 2012 6:17 PM, "Marco Vermeulen" <
reply@reply.github.com>
wrote:

Don't know if you both spend a lot of time on the command line, but no
console that I'm aware of has this behaviour.
Hitting enter always opens a new line on a shell. Be it bash, ksh, dos,
groovysh or even the roo shell.

It might be argued what the command to repeat should be (we've gone for
!), but I still don't think that simply hitting enter to repeat is a
sensible default. Bash uses !!, which is probably the better option.


Reply to this email directly or view it on GitHub:
#138 (comment)

Enter to repeat last command was how grails interactive behaved with the previous versions i.e. 1.3.7, 1.2.5

Maybe this behavior could be an option for those who want it? Where does one put grails configuration stuff?

Member

lhotari commented Aug 8, 2014

Closing outdated pull requests.

lhotari closed this Aug 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment