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
4
votes
1 answer

IntelliJ IDEA doesn't intercept JLine code completion in bebug mode

I tried to run simple Java application wich is used code completion. When I run it in separate console it works like a charm. But when I try to it via IntelliJ IDEA, then my IDE doesn't intercept code completion actions in debug mode. I tried to add…
Alex
  • 2,091
  • 6
  • 31
  • 49
4
votes
2 answers

How to save and load history between invocations of Scala JLine

I'm using Scala JLine in my CLI program. It's working fine, but it forgets my history every time I restart my program. I see a class called FileHistory, and I see the ConsoleReader class has a method called setHistory() which takes an instance of…
Adam Mackler
  • 1,980
  • 1
  • 18
  • 32
4
votes
2 answers

How to write an equivalent of KeyListener with JLine?

I am working on a console application written in Java. What I have to do is handle user keyboard input. When a long process in launched with our program in a terminal, the user must have the possibility to press 'q' at anytime to stop the process…
Olivier CLERO
  • 177
  • 15
3
votes
1 answer

jline keep prompt at the bottom

I am using jline and I have a neat ConsoleReader and everything works great. However, if you are typing something into the the prompt and there is output on stdout (from another thread), the output splits the word/command that you are typing. How…
Alec Gorge
  • 17,110
  • 10
  • 59
  • 71
3
votes
0 answers

How to set lineeditor to vi-mode in JShell

How to set lineeditor to vi-mode in JShell? The setting set editing-mode vi is in both $HOME/.inputrc and $HOME/.jline.rc, but it seems like Jshell does not respect any of them.
FooBee
  • 778
  • 7
  • 23
3
votes
2 answers

Java Command-Line App with own prompt

I'm writing a JAVA-Console-Application. After the user started the jar he should get a Commandline like the Linux shell, where he can enter commands. This is something I never programmed before. Normaly im writing GUI's or I start the jar with some…
Daniel
  • 1,027
  • 1
  • 8
  • 23
3
votes
1 answer

Bug in JLine2? ConsoleReader.clearScreen

EDIT: This feature only occurs when I invoke the clearScreen method of ConsoleReader! Any other changes don't have an effect. Is this then a bug in JLine2? JLine2: Why, when I run this, do I get two console prompts directly following each other…
jdurston
  • 199
  • 2
  • 14
3
votes
0 answers

Use inputrc inside sbt

I would like these settings to work seamless in my shell as well as in sbt. Is there something special I need to do to get these working? My ~/.inputrc: \C-Space:complete \C-i:menu-complete "\C-f": forward-word "\C-b": backward-word "\u26F5":…
gdoubleod
  • 1,268
  • 3
  • 19
  • 33
3
votes
0 answers

Incorrect behaviour of arrow keys using SBT on Windows 7

I'm using SBT 0.13.6 on Windows 7, and I'm running it using Cygwin (bash shell). I have a problem with the arrow keys: Arrow-up moves the cursor up, whereas I want it to cycle through the command history (and I think that's what it should do by…
Paul
  • 1,939
  • 1
  • 18
  • 27
3
votes
1 answer

Cursor key arrows not functioning in SBT 0.13.* . Suspect Jline. How to enable them?

SBT-0.7.7 had JLine bundled in the launcher and it works OK. E.g.: "C:\Program Files (x86)\Java\jre7\bin\java.exe" -jar C:\scala\sbt-launch-0.7.7.jar I can use cursor keys to navigate the command history. It does not work in…
user3603546
  • 325
  • 2
  • 11
3
votes
0 answers

Redirect input whith pipe and java

I have read Creating a Child Process with Redirected Input and Output in MSDN. And I have redirected output.But redirect input is different from this example in my case. I have run java -jar xxx.jar in child process.And redirect the input to the…
zzy
  • 1,771
  • 1
  • 13
  • 48
2
votes
0 answers

Spring Shell integration with IntelliJ console

I'm using Spring-Shell v2.1.4 with IntelliJ Utlimate IDE. If I use a Flow component in a shell method I find that it does not work when launched within IntelliJ but works fine from a plain Bash terminal. For example if I have a simple @ShellMethod…
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97
2
votes
0 answers

JLine system terminal issue

I have a problem with JLine 3.9.0. I created a terminal Terminal terminal = TerminalBuilder.builder().encoding("UTF-8").system(true).build(); First of all it shows a lot of errors, to be precise: WARNING: Unable to retrieve infocmp for type…
Eno_
  • 41
  • 7
2
votes
1 answer

Set terminal background color with Java

I have a Java program that uses JLine2 to handle input and output on the console terminal. For aesthetic reasons this program works best if the background color of the terminal is white. So, Is it possible to set the background color of the…
dariober
  • 8,240
  • 3
  • 30
  • 47
2
votes
1 answer

How is CTRL+C handled in jline2

I had a hard time trying to understand how is CTRL+C handled in jline2. I found in consoleReader.readline an exception will be thrown if handleUserInterrupt is set to true. But I wonder before this exception is thrown, how is CTRL+C is trapped and…
pythonician_plus_plus
  • 1,244
  • 3
  • 15
  • 38