Skip to content

Commit 87e71df

Browse files
iocanelgsmet
authored andcommitted
fix: false error message on cli plug with flags
(cherry picked from commit 14b98e3)
1 parent 2f01c66 commit 87e71df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.Optional;
1313
import java.util.concurrent.Callable;
1414
import java.util.function.Supplier;
15+
import java.util.regex.Pattern;
1516
import java.util.stream.Collectors;
1617

1718
import jakarta.inject.Inject;
@@ -176,7 +177,8 @@ public Optional<String> checkMissingCommand(CommandLine root, String[] args) {
176177
.collect(Collectors.toList());
177178
if (!unmatchedSubcommands.isEmpty()) {
178179
missingCommand.append("-").append(unmatchedSubcommands.get(0));
179-
return Optional.of(missingCommand.toString());
180+
// We don't want the root itself to be added to the result
181+
return Optional.of(missingCommand.toString().replaceFirst(Pattern.quote(root.getCommandName() + "-"), ""));
180182
}
181183

182184
currentParseResult = currentParseResult.subcommand();

0 commit comments

Comments
 (0)