diff --git a/picocli-shell-jline3/src/main/java/picocli/shell/jline3/PicocliCommands.java b/picocli-shell-jline3/src/main/java/picocli/shell/jline3/PicocliCommands.java index eb84cc480..c9a86c202 100644 --- a/picocli-shell-jline3/src/main/java/picocli/shell/jline3/PicocliCommands.java +++ b/picocli-shell-jline3/src/main/java/picocli/shell/jline3/PicocliCommands.java @@ -177,6 +177,7 @@ public void complete(LineReader reader, ParsedLine commandLine, List 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 { @@ -193,7 +194,9 @@ public void complete(LineReader reader, ParsedLine commandLine, List } 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())); + } } } }