Repository: quarkusio/quarkus
Issue: Quakrus CLI: --help command for 'create' is not working

### Describe the bug

Quakrus CLI for 999-SNAPSHOT fails with:

_Creating an app (default project type, see --help).
[ERROR] ❗  Unable to create project: Unknown option: '--help'_

when running:
java -jar $home/quarkus-main/devtools/cli/target/quarkus-cli-999-SNAPSHOT-runner.jar registry --help



### Expected behavior

Help for "create" command should appear

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

999-SNAPSHOT

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

_No response_

### Additional information

_No response_

Changed files:
devtools/cli/src/main/java/io/quarkus/cli/Registry.java, devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java, devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java, devtools/cli/src/main/java/io/quarkus/cli/Create.java, devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java

diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Create.java b/devtools/cli/src/main/java/io/quarkus/cli/Create.java
index 6b9e608ec9d..a8672a83530 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/Create.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/Create.java
@@ -3,6 +3,7 @@
 import java.util.List;
 import java.util.concurrent.Callable;
 
+import io.quarkus.cli.common.HelpOption;
 import io.quarkus.cli.common.OutputOptionMixin;
 import picocli.CommandLine;
 import picocli.CommandLine.ParseResult;
@@ -17,6 +18,9 @@ public class Create implements Callable<Integer> {
     @CommandLine.Mixin
     protected OutputOptionMixin output;
 
+    @CommandLine.Mixin
+    protected HelpOption helpOption;
+
     @CommandLine.Spec
     protected CommandLine.Model.CommandSpec spec;
 
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java
index 9b2fb38fb3b..b0f8e2bacae 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java
@@ -3,6 +3,7 @@
 import java.util.List;
 import java.util.concurrent.Callable;
 
+import io.quarkus.cli.common.HelpOption;
 import io.quarkus.cli.common.OutputOptionMixin;
 import picocli.CommandLine;
 import picocli.CommandLine.ParseResult;
@@ -17,6 +18,9 @@ public class Registry implements Callable<Integer> {
     @CommandLine.Mixin
     protected OutputOptionMixin output;
 
+    @CommandLine.Mixin
+    protected HelpOption helpOption;
+
     @CommandLine.Spec
     protected CommandLine.Model.CommandSpec spec;
 
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java
index 7a398062a66..ed1510b4cb5 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java
@@ -7,6 +7,7 @@
 import java.util.TreeMap;
 import java.util.concurrent.Callable;
 
+import io.quarkus.cli.common.HelpOption;
 import io.quarkus.cli.common.OutputOptionMixin;
 import io.quarkus.cli.common.RunModeOption;
 import io.quarkus.cli.common.TargetQuarkusVersionGroup;
@@ -34,6 +35,9 @@ public class BaseCreateCommand implements Callable<Integer> {
     @Mixin
     ToggleRegistryClientMixin registryClient;
 
+    @CommandLine.Mixin
+    protected HelpOption helpOption;
+
     @Spec
     protected CommandSpec spec;
 
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java
index 7078e12881a..1a740fb5da4 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java
@@ -2,6 +2,7 @@
 
 import java.util.concurrent.Callable;
 
+import io.quarkus.cli.common.HelpOption;
 import io.quarkus.cli.common.OutputOptionMixin;
 import picocli.CommandLine;
 import picocli.CommandLine.Mixin;
@@ -16,6 +17,9 @@ public class BaseRegistryCommand implements Callable<Integer> {
     @Mixin
     protected RegistryClientMixin registryClient;
 
+    @CommandLine.Mixin
+    protected HelpOption helpOption;
+
     @Spec
     protected CommandSpec spec;
 
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java
index 59552333a2f..d41e6923e20 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java
@@ -24,6 +24,7 @@ public class CliHelpTest {
     public void testCommandHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
 
         CliDriver.Result result2 = CliDriver.execute(workspaceRoot);
         Assertions.assertEquals(result.stdout, result2.stdout, "Invoking the base command should show usage help");
@@ -31,52 +32,59 @@ public void testCommandHelp() throws Exception {
     }
 
     @Test
-    @Order(20)
+    @Order(10)
     public void testCreateHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(21)
+    @Order(11)
     public void testCreateAppHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(22)
+    @Order(12)
     public void testCreateCliHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "cli", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(23)
+    @Order(13)
     public void testCreateExtensionHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "extension", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(30)
+    @Order(20)
     public void testBuildHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "build", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(40)
+    @Order(30)
     public void testDevHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "dev", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(50)
+    @Order(40)
     public void testExtHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
 
         CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "extension", "--help");
         Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same.");
@@ -84,10 +92,11 @@ public void testExtHelp() throws Exception {
     }
 
     @Test
-    @Order(51)
+    @Order(41)
     public void testExtCatHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "cat", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
 
         CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "ext", "cat", "--help");
         Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same.");
@@ -95,10 +104,11 @@ public void testExtCatHelp() throws Exception {
     }
 
     @Test
-    @Order(52)
+    @Order(42)
     public void testExtListHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "ls", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
 
         CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "ext", "list", "--help");
         Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same.");
@@ -106,28 +116,63 @@ public void testExtListHelp() throws Exception {
     }
 
     @Test
-    @Order(53)
+    @Order(43)
     public void testExtAddHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "add", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
-    @Order(53)
+    @Order(44)
     public void testExtRemoveHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "rm", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
 
         CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "ext", "remove", "--help");
         Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same.");
         CliDriver.println("-- same as above\\n\\n");
     }
 
+    @Test
+    @Order(50)
+    public void testRegistryHelp() throws Exception {
+        CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "--help");
+        result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
+    }
+
+    @Test
+    @Order(51)
+    public void testRegistryListHelp() throws Exception {
+        CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "list", "--help");
+        result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
+    }
+
+    @Test
+    @Order(51)
+    public void testRegistryAddHelp() throws Exception {
+        CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "add", "--help");
+        result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
+    }
+
+    @Test
+    @Order(52)
+    public void testRegistryRemoveHelp() throws Exception {
+        CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "rm", "--help");
+        result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
+    }
+
     @Order(60)
     @Test
     public void testGenerateCompletionHelp() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "completion", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test
@@ -135,6 +180,7 @@ public void testGenerateCompletionHelp() throws Exception {
     public void testCommandVersion() throws Exception {
         CliDriver.Result result = CliDriver.execute(workspaceRoot, "version", "--help");
         result.echoSystemOut();
+        Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions");
     }
 
     @Test