spring-shell icon indicating copy to clipboard operation
spring-shell copied to clipboard

CompletionResolvers for Array-Like Options

Open tschoellhorn opened this issue 1 year ago • 2 comments
trafficstars

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 avatar Oct 09 '24 04:10 tschoellhorn

@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.

corneil avatar Nov 13 '24 09:11 corneil

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

alienhunter3010 avatar Jan 12 '25 22:01 alienhunter3010