picocli icon indicating copy to clipboard operation
picocli copied to clipboard

Autocomplete completely ignores arity

Open jsotuyod opened this issue 2 years ago • 0 comments

Given a command with arity > 1 (and not a file / path type), autcomplete will only work for the first value. Given the code:

    @Command(mixinStandardHelpOptions = true)
    public static class DummyCommand {
        @Option(names = "--values", completionCandidates = CandidatesCompletion.class, arity = "2")
        public String[] values;

        public static class CandidatesCompletion implements Iterable<String> {

            @Override
            public Iterator<String> iterator() {
                return Arrays.asList("option1", "option2", "option3").iterator();
            }
        }
    }

The behavior observed under zsh is as follows:

First value (correct):

$ mycommand --values option<TAB><TAB>
option1  option2  option3

Second value (incorrect):

$ mycommand --values option1 op<TAB><TAB>
(empty, or files starting with "op")

jsotuyod avatar Jul 27 '22 17:07 jsotuyod