diff --git a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java index a618a7ae3273e..c39ea351ecbcc 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java @@ -12,6 +12,7 @@ import java.util.Optional; import java.util.concurrent.Callable; import java.util.function.Supplier; +import java.util.regex.Pattern; import java.util.stream.Collectors; import jakarta.inject.Inject; @@ -176,7 +177,8 @@ public Optional checkMissingCommand(CommandLine root, String[] args) { .collect(Collectors.toList()); if (!unmatchedSubcommands.isEmpty()) { missingCommand.append("-").append(unmatchedSubcommands.get(0)); - return Optional.of(missingCommand.toString()); + // We don't want the root itself to be added to the result + return Optional.of(missingCommand.toString().replaceFirst(Pattern.quote(root.getCommandName() + "-"), "")); } currentParseResult = currentParseResult.subcommand();