From 7101d006507d6cc31ed3337e2e2e66aac44d0893 Mon Sep 17 00:00:00 2001 From: Ioannis Canellos Date: Mon, 8 May 2023 17:16:55 +0300 Subject: [PATCH] fix: nesting of cli plugins (cherry picked from commit 8e478ea3c625c835f5f02fed331b7ea6307c309c) --- .../main/java/io/quarkus/cli/plugin/PluginCommandFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devtools/cli/src/main/java/io/quarkus/cli/plugin/PluginCommandFactory.java b/devtools/cli/src/main/java/io/quarkus/cli/plugin/PluginCommandFactory.java index 1f7b13d78f06a..af236f4f08154 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/plugin/PluginCommandFactory.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/plugin/PluginCommandFactory.java @@ -81,7 +81,9 @@ public void populateCommands(CommandLine cmd, Map plugins) { plugins.entrySet().stream() .map(Map.Entry::getValue).forEach(plugin -> { CommandLine current = cmd; - String name = plugin.getName(); + // The plugin is stripped from its prefix when added to the catalog. + // Let's added back to ensure it matches the CLI root command. + String name = cmd.getCommandName() + "-" + plugin.getName(); while (current != null && current.getCommandName() != null && name.startsWith(current.getCommandName() + "-")) { String remaining = name.substring(current.getCommandName().length() + 1);