Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding command recall to a Unix command line application

I'm working on a command line application for Solaris, written in Java6. I'd like to be able to scroll through a history of previous commands using the up and down arrows like many Unix tools allow (shells, VIM command mode prompt, etc).

Is there any standard way of achieving this, or do I have to roll my own?

like image 266
Andrew Avatar asked Jul 16 '26 22:07

Andrew


2 Answers

Yes, use the GNU readline library.

like image 190
Pat Notz Avatar answered Jul 18 '26 12:07

Pat Notz


I think you are looking for something like JLine but I've never used it so cannot attest to its quality.

She can apparently deal with autocompletion and command line history, and the last release was recently (feb this year) so it's by no means dead.

like image 42
SCdF Avatar answered Jul 18 '26 11:07

SCdF



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!