Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317657 - [console] add command history
Summary: [console] add command history
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Components (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: Juno M7   Edit
Assignee: equinox.components-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-23 03:26 EDT by Glyn Normington CLA
Modified: 2012-05-07 11:27 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glyn Normington CLA 2010-06-23 03:26:21 EDT
The Virgo project has a requirement for command history to be supported in the Equinox console.

We had to drop our jline support which provided command history (up arrow retrieval of earlier commands) because of the failure to get Eclipse legal approval for jline.
Comment 1 Thomas Watson CLA 2010-06-23 09:53:47 EDT
Lazar and team at SAP have been investigating removing the console from the framework in bug 169603 and are considering adding this enhancement once we have removed it from the framework.
Comment 2 Thomas Watson CLA 2011-11-30 10:40:06 EST
Lazar, is this fixed in the gogo based console?
Comment 3 Lazar Kirchev CLA 2011-11-30 10:46:25 EST
(In reply to comment #2)
> Lazar, is this fixed in the gogo based console?

Yes, this is fixed.
Comment 4 Thomas Watson CLA 2011-11-30 14:18:52 EST
Marking as fixed since the gogo based console is in M3.
Comment 5 DJ Houghton CLA 2011-11-30 15:54:37 EST
I start up an Eclipse with -console and try to use the arrow keys in the osgi console and it doesn't work. I'm using this week's i-build so it is after M3. Shouldn't this work?
Comment 6 Thomas Watson CLA 2011-12-01 13:48:26 EST
(In reply to comment #5)
> I start up an Eclipse with -console and try to use the arrow keys in the osgi
> console and it doesn't work. I'm using this week's i-build so it is after M3.
> Shouldn't this work?

hmmm, I think command history only works for telnet sessions.  Lazar, please comment.
Comment 7 Lazar Kirchev CLA 2011-12-02 02:13:05 EST
(In reply to comment #6)
> (In reply to comment #5)
> > I start up an Eclipse with -console and try to use the arrow keys in the osgi
> > console and it doesn't work. I'm using this week's i-build so it is after M3.
> > Shouldn't this work?
> 
> hmmm, I think command history only works for telnet sessions.  Lazar, please
> comment.

Yes, history and tab completion are available for telnet and ssh sessions. Since ssh is not included in the build yet, only the telnet supports currently this functionality. 
But as for history, I think we could provide this for the standard input as well. For tab completion it is more tricky.
Comment 8 Thomas Watson CLA 2011-12-02 09:57:29 EST
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > I start up an Eclipse with -console and try to use the arrow keys in the osgi
> > > console and it doesn't work. I'm using this week's i-build so it is after M3.
> > > Shouldn't this work?
> > 
> > hmmm, I think command history only works for telnet sessions.  Lazar, please
> > comment.
> 
> Yes, history and tab completion are available for telnet and ssh sessions.
> Since ssh is not included in the build yet, only the telnet supports currently
> this functionality. 
> But as for history, I think we could provide this for the standard input as
> well. For tab completion it is more tricky.

It would be interesting to see if history could be added.  Also note that eclipse console view also creates sessions though the org.eclipse.osgi.framework.console.ConsoleSession API to connect to the running instance of OSGi.  I wonder if such sessions could also allow for history.

I am not on windows now, but DJ and I seem to recall that the Windows command "shell" used to recall previous commands by using the up/down arrow keys with the old console when using Standard in/out.  Not sure if that is still true with the new gogo based shell.  I suspect it still works though since I imagine that is a "feature" of the Windows command "shell" rather than the osgi console code.
Comment 9 Lazar Kirchev CLA 2011-12-02 10:28:47 EST
(In reply to comment #8)

> It would be interesting to see if history could be added.  
I think if I wrap the stream before passing it to Gogo, I could add history. Actually, this is the way i do it with telnet/ssh. 

> Also note that
> eclipse console view also creates sessions though the
> org.eclipse.osgi.framework.console.ConsoleSession API to connect to the running
> instance of OSGi.  I wonder if such sessions could also allow for history.

I was quite sure that it uses this API, although I couldn't find the exact code. But yes, these sessions allow for history - I first implemented history in telnet this way (before using Gogo). The shell in Vergo prior to 3.0.0 release uses this version.
 
> I am not on windows now, but DJ and I seem to recall that the Windows command
> "shell" used to recall previous commands by using the up/down arrow keys with
> the old console when using Standard in/out.  Not sure if that is still true
> with the new gogo based shell.  I suspect it still works though since I imagine
> that is a "feature" of the Windows command "shell" rather than the osgi console
> code.

This still works in the new shell. You are right that this is a "feature" of the Windows command "shell" and not of the osgi console. 

Another such "feature" of the Windows command "shell" is the buffering of the standard input stream, which is flushed only after new line - that is why I haven't implemented tab completion for the standard input. Pressing tab just does nothing - you cannot read the tab char from the stream and handle it before enter ends the input.
Comment 10 Thomas Watson CLA 2012-04-25 11:14:55 EDT
Has this been done?  I would suggest deferring to Keplar if not.
Comment 11 Lazar Kirchev CLA 2012-04-30 06:47:55 EDT
(In reply to comment #10)
> Has this been done?  I would suggest deferring to Keplar if not.

Best to defer it for Kepler. This feature could be tricky - if you run Equinox and the console standalone, you actually get history for free from the OS. If I provide additional history most probably it would work in the PDE but in the standalone case there could be problems.
Comment 12 Thomas Watson CLA 2012-04-30 09:22:44 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Has this been done?  I would suggest deferring to Keplar if not.
> 
> Best to defer it for Kepler. This feature could be tricky - if you run Equinox
> and the console standalone, you actually get history for free from the OS. If I
> provide additional history most probably it would work in the PDE but in the
> standalone case there could be problems.

Part of this has been done at lest for telnet and ssh connections.  I suggest we close this bug as fixed for telnet and ssh connections for Juno and open a separate bug for kepler.  Lazar, can you do that?
Comment 13 Lazar Kirchev CLA 2012-05-04 01:44:31 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > (In reply to comment #10)
> > > Has this been done?  I would suggest deferring to Keplar if not.
> > 
> > Best to defer it for Kepler. This feature could be tricky - if you run Equinox
> > and the console standalone, you actually get history for free from the OS. If I
> > provide additional history most probably it would work in the PDE but in the
> > standalone case there could be problems.
> 
> Part of this has been done at lest for telnet and ssh connections.  I suggest
> we close this bug as fixed for telnet and ssh connections for Juno and open a
> separate bug for kepler.  Lazar, can you do that?

Yes, I will open a new one for Keplar.
Comment 14 Thomas Watson CLA 2012-05-04 08:54:59 EDT
Closing this bug out for Juno M7.
Comment 15 Lazar Kirchev CLA 2012-05-07 11:27:17 EDT
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #11)
> > > (In reply to comment #10)
> > > > Has this been done?  I would suggest deferring to Keplar if not.
> > > 
> > > Best to defer it for Kepler. This feature could be tricky - if you run Equinox
> > > and the console standalone, you actually get history for free from the OS. If I
> > > provide additional history most probably it would work in the PDE but in the
> > > standalone case there could be problems.
> > 
> > Part of this has been done at lest for telnet and ssh connections.  I suggest
> > we close this bug as fixed for telnet and ssh connections for Juno and open a
> > separate bug for kepler.  Lazar, can you do that?
> 
> Yes, I will open a new one for Keplar.

The KEpler bug - bug 378595.