Using JLine 3.5.2, I'm trying to setup a completer for something like this:
cmd1 -argA argAvalue -argB argBvalue -argC argCvalue
cmd2 -argX argXvalue -argY argYvalue -argZ argZvalue
The order of the arguments does not matter, so I wanted to be able to handle argA, argB, and argC being in any order.
I attempted to create an ArgumentCompleter for each command, and then combine them in an aggregate, like this:https://github.com/bbende/jline-examples/blob/master/src/main/java/com/bbende/jline/MultiArgumentCompleterIssue.java#L34-L49
With the code exactly as it is, the completion of the commands will work until you have typed the value of the first argument:
cm1 -argA foo
At that point, no more completion occurs because "foo" does not match anything. If you only type "cmd -argA " and didn't type foo, then you would be able to hit tab again and see the other available args for cmd1.
If call setStrict(false) on each of the argument completers in the above code, it allows completion to continue working, but has the side effect that completion is no longer limited to the given command.
Typing tab after entering "cmd1 " will display the args of both commands.
Typing tab after entering "cmd1 -argA foo -arg" will display the args of both commands.
Any thoughts how to achieve this?