2

I want to use JLine to build a simple CLI. But I ran into a problem. File name completer doesn't work properly on Windows.

When I enter 8> first C:\ and press tab, completer do nothing although it should display all subfolders.

Here is my code:

ArgumentCompleter completer1 = new ArgumentCompleter(
    new StringsCompleter("first"),
    new FileNameCompleter(),
    new NullCompleter()
);

ArgumentCompleter completer2 = new ArgumentCompleter(
    new StringsCompleter("second"),
    new NullCompleter()
);

AggregateCompleter completer3 = new AggregateCompleter(
    completer1, completer2
);

ConsoleReader console = new ConsoleReader();
console.addCompleter(completer3);

while (true) {
    String line = console.readLine("8> ");
    if (line.isEmpty()){
        console.println();
    }
}

Any ideas how to fix this?

Alex
  • 2,091
  • 6
  • 31
  • 49
  • I am also facing similar issue, i am running from eclipse.. i just get prompt but cannot read my input. – Sohan Sep 02 '15 at 06:28
  • You should use double backslash "\\". – Alex Sep 05 '15 at 21:23
  • Can you tell why in eclipse i can read input?When i run in eclipse i cant see any input being read from keyboard. I searched for eclipse console settings but nothing fancy found – Sohan Sep 07 '15 at 05:48
  • See this question with answers: http://stackoverflow.com/questions/12091506/what-is-the-backslash-character – Alex Sep 20 '15 at 09:25

0 Answers0