Skip to content

Commit

Permalink
Issue #2074 AutoComplete with jline3 is showing hidden values
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic authored and remkop committed Jul 30, 2023
1 parent f132312 commit 460496b
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 460496b

Please sign in to comment.