Skip to content

Commit

Permalink
Issue remkop#2074 AutoComplete with jline3 is showing hidden values
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Jul 28, 2023
1 parent cb8aa7e commit 9a53050
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public void complete(LineReader reader, ParsedLine commandLine, List<Candidate>
String buffer = word.substring(0, commandLine.wordCursor());
int eq = buffer.indexOf('=');
for (OptionSpec option : sub.getCommandSpec().options()) {
if (option.hidden()) continue;
if (option.arity().max() == 0 && eq < 0) {
addCandidates(candidates, Arrays.asList(option.names()));
} else {
Expand All @@ -193,7 +194,9 @@ public void complete(LineReader reader, ParsedLine commandLine, List<Candidate>
} else {
addCandidates(candidates, sub.getSubcommands().keySet());
for (CommandLine s : sub.getSubcommands().values()) {
addCandidates(candidates, Arrays.asList(s.getCommandSpec().aliases()));
if (!s.getCommandSpec().usageMessage().hidden()) {
addCandidates(candidates, Arrays.asList(s.getCommandSpec().aliases()));
}
}
}
}
Expand Down

0 comments on commit 9a53050

Please sign in to comment.