Skip to content

Commit

Permalink
fix: false error message on cli plug with flags
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Aug 27, 2024
1 parent 03b025c commit 14b98e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -176,7 +177,8 @@ public Optional<String> 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();
Expand Down

0 comments on commit 14b98e3

Please sign in to comment.