Autocompletion Jline issue

I am currently using JLine library for its autocompletion feature.
I am currentlys stuck in this test case where we are needed to parse the executable. and i think i am parsing it correctly. i cant figure out whats the problem.

here is the github repo : GitHub - Molik2801/codecrafters-shell-java

Hey @Molik2801, this looks like a quoting issue.

Only the part highlighted in red is the executable name. Everything after that (i.e. /tmp/pig/f3) are argument(s), not part of the executable name:

I tried running your code against the previous stages, but it’s actually no longer passing a previous stage #YT5 (Quoting - Backslash outside quotes).

Suggestions:

  1. Use our CLI to test against previous stages by running:
codecrafters test --previous
  1. Focus on fixing the early stages first, as later stages depend on them.

ya i know thats why i printed my input and getting correct inputs , here i got two element in input , where first is execcutable and seccond is argument.
this problem is happening after i used JLine.

image

i found out that Jline is parsing beforehand so it is giving wrong output.
how can i fix that.
Like Jline is parsing echo hi \ \ \ hi as hi hi , instead of hi hi. means it is removing the extra spaces on its own. how can i reimplement that.

Hey Problem Solved Finally after 2 Weeks :face_exhaling: .

i have to change the Jline behaviour of taking backslash into consideration and removing it before giving it to my Parser code.
so ,
var parser = new DefaultParser();

parser.setEscapeChars(new char[0]);

these lines made sure that Jline is not eating away my backslash
rest was fine.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.