spring-projects/spring-shell

CompletionResolvers for Array-Like Options

tschoellhorn opened this issue · 2 comments

I have an issue regarding the CommandCompletion for @commands which have Options with an arity with ONE_OR_MORE.

I have a command like this:

@Command(command = "indexer index",)
public String index(	
@Option(
	longNames = "names", 
	required = false, 
	arity = OptionArity.ONE_OR_MORE
@OptionValues(provider = "snapshotConverter") Snapshot[] snaps) {
....
}

I also have implemented an CompletionResolver which makes proposals with possible matchin "Snapshots".

BUT: The CompletionResolver is only called for the first Option. When I separate the Options with empty space or comma my CompletionResover is not called any more. Yet, typing the complete "Snapshot"s results in the array of Snapshots.

So - is this a missing feature or is there some point I overlook?

@tschoellhorn Can I ask you for a small project that reproduces the issue. I'm not 100% clear on what you typed and what you expected and what actually happened.

Same issue, here. To describe it I have this commands that sum double values:

> sum --nums [TAB]
--help              -h                  2.718281828459045   3.141592653589793

If I chose the 1st value

> sum --nums 2.718281828459045 [TAB]
--help   -h

I can't select PI value