Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java command line "shell" with auto-complete

I need to create a Java command line to that will be invoked remotely on a server. It will need to:

  • Read "lines" of text from the user.
  • Recognise if the user presses the "tab" key to facilitate auto-complete.
  • Recognise if the user presses the "up/down" keys for history.

Before I go off and roll my own, Is anyone aware of a Java library that might facilitate all or part of this?

i.e. From the command line in ssh it might look like this:

bob> java -jar MyTool.jar

MyTool Started.
Please enter command:

> server1 startup
server starting...
server started

> server2 load accounts
Done

> server3 shutdown
Complete

>quit

like image 347
Jay Avatar asked Sep 26 '12 05:09

Jay


1 Answers

Check out JReadline and jline2.

like image 194
Edward Samson Avatar answered Nov 15 '22 00:11

Edward Samson