Details
-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 4.0.9
-
Fix Version/s: None
-
Component/s: karaf
-
Labels:None
Description
Commands bail out when a starting quote - single or double quote - preceedes a tab-completion.
E.g.:
Type
feature:install -s
and hit the tab key, you are prompted with the question whether you want to see all 40+ completions.
But if you type
feature:install -s " # also with a single quote, btw
and then hit the tab key, you see an error: Error executing command: String index out of range: 21
The log shows:
2017-07-12 21:39:44,803 | ERROR | nsole user karaf | ShellUtil | 43 - org.apache.karaf.shell.core - 4.0.9 | Exception caught while executing command java.lang.StringIndexOutOfBoundsException: String index out of range: 21 at java.lang.String.substring(String.java:1963)[:1.8.0_131] at org.apache.karaf.shell.support.parsing.GogoParser.value(GogoParser.java:300)[43:org.apache.karaf.shell.core:4.0.9] at org.apache.karaf.shell.support.parsing.GogoParser.messy(GogoParser.java:223)[43:org.apache.karaf.shell.core:4.0.9] at org.apache.karaf.shell.support.parsing.GogoParser.statement(GogoParser.java:195)[43:org.apache.karaf.shell.core:4.0.9] at org.apache.karaf.shell.support.parsing.DefaultParser.parse(DefaultParser.java:34)[43:org.apache.karaf.shell.core:4.0.9] at org.apache.karaf.shell.impl.console.parsing.CommandLineParser.buildCommandLine(CommandLineParser.java:56)[43:org.apache.karaf.shell.core:4.0.9] at org.apache.karaf.shell.impl.console.CompleterAsCompletor.complete(CompleterAsCompletor.java:42)[43:org.apache.karaf.shell.core:4.0.9] at jline.console.ConsoleReader.complete(ConsoleReader.java:3296)[9:jline:2.14.1] at jline.console.ConsoleReader.readLine(ConsoleReader.java:2636)[9:jline:2.14.1] at jline.console.ConsoleReader.readLine(ConsoleReader.java:2362)[9:jline:2.14.1] at jline.console.ConsoleReader.readLine(ConsoleReader.java:2350)[9:jline:2.14.1] at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.readAndParseCommand(ConsoleSessionImpl.java:373)[43:org.apache.karaf.shell.core:4.0.9] at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:269)[43:org.apache.karaf.shell.core:4.0.9] at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]
What I would like to achieve, actually is with a StringsCompleter that accepts say 4 constants ("CODE", "TIME", "RUN", "ERROR"), I'd like to get multiple completions in the end.
In other words, I would like to be able to this:
> cool-command --expr '(CODE="A34" and TIME=60) or (RUN > 10 and ERROR="E517")'
where each green completion above I would tab-select as I type along.
This is currently not possible.