I want app to print on each line its name like (shell >
):
shell > --param1 value1 --param2 value2
Is it possible to implement it by jline3?
See JLine readLine() javadoc. Add command prompt (shell >
) to your CLI app call readLine
method as
lineReader.readLine("shell > ", null, null);
If you want to add buffer also the default value for user to edit call readLine
method as
lineReader.readLine("shell > ", null, "--param1 value1 --param2 value2");
You can do this using jline3-terminal. It has support for 'jansi' and 'jna'. Both work near same, but jansi is a bit light weight than jna. Whereas jna is more generic.
You can follow documentation here and the also the terminal documentation here.
Prefer maven project to start with and go ahead with documentation.
Let me know for anything else.