Questions tagged [jline]

JLine is a Java library for handling console input. It is similar in functionality to BSD editline and GNU readline. People familiar with the readline/editline capabilities for modern shells (such as bash and tcsh) will find most of the command editing features of JLine to be familiar.

JLine is a Java library for handling console input. It is similar in functionality to BSD editline and GNU readline. People familiar with the readline/editline capabilities for modern shells (such as bash and tcsh) will find most of the command editing features of JLine to be familiar.

JLine 2.x is an evolution of JLine 1.x which was previously maintained at SourceForge.

Features

JLine sports the following major features:

  1. Command history - Lines that have been previously entered may be recalled and edited and can be persisted so that they are available across sessions of your program.

  2. Line editing - JLine allows full editing of the current command line and attempts to mimic as much of the behavior of GNU Readline as possible, including support for both emacs and vi key mappings.

  3. Completion - JLine provides a pluggable mechanism for implementing command line tab completion (of course completion can be bound to any key you wish).

  4. Custom Key bindings - Keys may be arbitrarily remapped to perform a specific action, and JLine attempts to honor any mapping that is set in your existing readline .inputrc file.

  5. Character Masking - Input may be gathered from the user without any visual feedback. This is useful for prompting for passwords.

  6. 99.99% Java - The vast portion of JLine is all Java, using only some small bit of native code, provided by the Jansi project, to support Windows.

89 questions
1
vote
2 answers

How do I use conditional operator shell:if in karaf / jline

I am trying to conditionally execute a command using the apache karaf command line, which uses the jline library. I can't find any documentation on the shell:if command. For example in linux shell this works: if [ "foo" = "foo" ]; then echo "good";…
Don Corley
  • 496
  • 2
  • 7
1
vote
1 answer

Once jLine writes over one line to shell, we can't go back to original line

I've encountered the following problem with jLine. We open the command prompt (both linux and windows) and enter a stream of letters until it "spills" over to the next line. for…
jonatzin
  • 922
  • 1
  • 13
  • 30
0
votes
0 answers

Up arrow based command history in console input (Java)

I am currently using: Scanner scanner = new Scanner(System.in); To get user input in Java, but I want to add a way for user to use previous command easily. If users presses UP key it should show previous command instead of ^[[A. It shouldn't…
Norbiros
  • 3
  • 3
0
votes
0 answers

How to open a new terminal tab using Spring boot dependency Spring Shell

I have certain use case which requires opening of a new terminal tab/window from current terminal window, both terminal will be running in different context. For eg. a chat application is running on the main terminal and whenever a new chat request…
JCodeX
  • 19
  • 1
  • 9
0
votes
0 answers

JLine completer with Brigadier

I want to make a console application with jline and brigadier, but I have problem on command completing. I can complete the literal command but can't complete argument commands. What I did: private static List
0
votes
1 answer

Why does jline's TerminalBuilder not accept function call?

Please dont ban me for this question, i am a noob and i have googled this for hours now. To make a console based Snake Game, i plan to use the jline Libary. However, when i try to call "Terminal" 's function getHeight()(i imported org.jline.Terminal…
0
votes
0 answers

How to change the cursor position while pressing tab to complete input command in a java cli program?

I'm writing a cli program which can send messages to users by commands. The messages are complex, consists of one or more single part(s), and each part can be a text, image, emoji, at (@somebody) and etc. To input that message by commands, I made a…
CHUANWISE
  • 68
  • 6
0
votes
1 answer

How can I emit text on the command line with a strike-though effect using JLine?

I'm using JLine for a console application and I would like to emit text with a strike-through effect. Is this possible with JLine and how would I do it? Are there any platform-specific concerns?
soc
  • 27,983
  • 20
  • 111
  • 215
0
votes
1 answer

Jline with completion candidates having space giving unexpected output

I am using Jline 3.21.0 and trying to run a simple test with reference from https://github.com/jline/jline3/blob/master/reader/src/test/java/org/jline/reader/completer/StringsCompleterTest.java Below is one of the modified testcase with candidates…
Amol B
  • 21
  • 1
  • 4
0
votes
1 answer

Sending commands to external program using JLine reader not working

I have a program that runs another Java program and sends commands to the program but it doesnt detect the commands. The program I am sending to the commands to uses JLine so I think that is the problem, it works for other programs that dont use it.…
JustDoom
  • 99
  • 9
0
votes
1 answer

Minecraft like console in java

So I am working on a http server app thing, and I need to make a inbuilt shell for some stuff (like minecraft). I tried a lot with jline but cannot get a proper prompt without the logs messing up the prompt input. Here's what I want: The prompt to…
0
votes
1 answer

Running jar results in ClassNotFoundException (Gradle)

So I'm relatively inexperienced on how gradle works, and I need some help getting my jar working. My application generates some files through the terminal. However, when I try to run the jar, it gives me an error. build.gradle: plugins { id…
0
votes
1 answer

jline problems with escape character in completion

I am working on a project with jline version3 in java but in completion, I need to have "else if" but it puts \ to escape space as an escape character and I don't have any escape character also I tried null instead of a char[] but it crashes with…
radinParsaei
  • 28
  • 1
  • 6
0
votes
2 answers

Single title in JLine 3 help output

How do I customize the help command in JLine 3? The help in my JLine 3 shell sample displays as: manager> help System: exit exit from app/script help command help Builtins: ShellCommandRegistry: create Create some stuff with…
Jan Nielsen
  • 10,892
  • 14
  • 65
  • 119
0
votes
1 answer

How to run interactive bash using Java ProcessBuilder API?

I am trying to start bash using java ProcessBuilder API: code: public class BashExecutor { public void executeCommand(String[] command, Consumer consumer) { ProcessBuilder processBuilder = new ProcessBuilder(); …
vkp
  • 91
  • 4
  • 17