This is an automated email from the ASF dual-hosted git repository.

bamaer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 3e0974a8ee add missing --help to commands, fixes #9268 (#9270)
3e0974a8ee is described below

commit 3e0974a8eed1d201a60accd81505c1a82230c9cc
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Wed Nov 4 17:52:11 2026 +0100

    add missing --help to commands, fixes #9268 (#9270)
---
 .../main/java/org/apache/hop/imp/HopImport.java    | 11 ++--
 .../main/java/org/apache/hop/search/HopSearch.java | 11 ++--
 .../apache/hop/imp/HopImportHelpOptionsTest.java   | 50 ++++++++++++++++++
 .../hop/search/HopSearchHelpOptionsTest.java       | 60 ++++++++++++++++++++++
 .../apache/hop/naming/command/HopNamingCheck.java  |  7 ++-
 .../command/HopNamingCheckHelpOptionsTest.java     | 50 ++++++++++++++++++
 6 files changed, 180 insertions(+), 9 deletions(-)

diff --git a/engine/src/main/java/org/apache/hop/imp/HopImport.java 
b/engine/src/main/java/org/apache/hop/imp/HopImport.java
index ec1e9dda9c..eaaa593f20 100644
--- a/engine/src/main/java/org/apache/hop/imp/HopImport.java
+++ b/engine/src/main/java/org/apache/hop/imp/HopImport.java
@@ -54,10 +54,7 @@ import picocli.CommandLine.ParameterException;
 @SuppressWarnings("java:S106")
 @Getter
 @Setter
-@Command(
-    description = "Import metadata",
-    versionProvider = HopVersionProvider.class,
-    mixinStandardHelpOptions = true)
+@Command(description = "Import metadata", versionProvider = 
HopVersionProvider.class)
 @HopCommand(id = "import", description = "Import ")
 public class HopImport implements Runnable, IHasHopMetadataProvider, 
IHopCommand {
   private static final String CONST_IMPORT = "Import is ";
@@ -121,6 +118,12 @@ public class HopImport implements Runnable, 
IHasHopMetadataProvider, IHopCommand
       description = "List the available import plugins")
   private Boolean listPluginTypes;
 
+  @Option(
+      names = {"-h", "--help"},
+      usageHelp = true,
+      description = "Displays this help message and quits.")
+  private boolean helpRequested;
+
   @Option(
       names = {"-v", "--version"},
       versionHelp = true,
diff --git a/engine/src/main/java/org/apache/hop/search/HopSearch.java 
b/engine/src/main/java/org/apache/hop/search/HopSearch.java
index 90444e4da9..cb68717a95 100644
--- a/engine/src/main/java/org/apache/hop/search/HopSearch.java
+++ b/engine/src/main/java/org/apache/hop/search/HopSearch.java
@@ -63,12 +63,15 @@ import picocli.CommandLine.Parameters;
 
 @Getter
 @Setter
-@Command(
-    versionProvider = HopVersionProvider.class,
-    description = "Search in Hop metadata",
-    mixinStandardHelpOptions = true)
+@Command(versionProvider = HopVersionProvider.class, description = "Search in 
Hop metadata")
 @HopCommand(id = "search", description = "Search in Hop metadata")
 public class HopSearch implements Runnable, IHasHopMetadataProvider, 
IHopCommand {
+  @Option(
+      names = {"-h", "--help"},
+      usageHelp = true,
+      description = "Displays this help message and quits.")
+  private boolean helpRequested;
+
   @Option(
       names = {"-v", "--version"},
       versionHelp = true,
diff --git 
a/engine/src/test/java/org/apache/hop/imp/HopImportHelpOptionsTest.java 
b/engine/src/test/java/org/apache/hop/imp/HopImportHelpOptionsTest.java
new file mode 100644
index 0000000000..e4eff88261
--- /dev/null
+++ b/engine/src/test/java/org/apache/hop/imp/HopImportHelpOptionsTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hop.imp;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import picocli.CommandLine;
+
+/** -h/--help and -v/--version must be recognised (#9268). */
+class HopImportHelpOptionsTest {
+
+  @ParameterizedTest
+  @ValueSource(strings = {"-h", "--help"})
+  void helpOptionIsRecognised(String option) {
+    CommandLine cmd = new CommandLine(new HopImport());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs(option);
+
+    assertTrue(parseResult.isUsageHelpRequested());
+    assertFalse(parseResult.isVersionHelpRequested());
+  }
+
+  @ParameterizedTest
+  @ValueSource(strings = {"-v", "--version"})
+  void versionOptionIsRecognised(String option) {
+    CommandLine cmd = new CommandLine(new HopImport());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs(option);
+
+    assertTrue(parseResult.isVersionHelpRequested());
+    assertFalse(parseResult.isUsageHelpRequested());
+  }
+}
diff --git 
a/engine/src/test/java/org/apache/hop/search/HopSearchHelpOptionsTest.java 
b/engine/src/test/java/org/apache/hop/search/HopSearchHelpOptionsTest.java
new file mode 100644
index 0000000000..e4641bf921
--- /dev/null
+++ b/engine/src/test/java/org/apache/hop/search/HopSearchHelpOptionsTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hop.search;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import picocli.CommandLine;
+
+/** -h/--help and -v/--version must be recognised (#9268). */
+class HopSearchHelpOptionsTest {
+
+  @ParameterizedTest
+  @ValueSource(strings = {"-h", "--help"})
+  void helpOptionIsRecognised(String option) {
+    CommandLine cmd = new CommandLine(new HopSearch());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs(option);
+
+    assertTrue(parseResult.isUsageHelpRequested());
+    assertFalse(parseResult.isVersionHelpRequested());
+  }
+
+  @Test
+  void helpWithoutSearchStringDoesNotFailOnRequiredParameter() {
+    CommandLine cmd = new CommandLine(new HopSearch());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs("--help");
+
+    assertTrue(parseResult.isUsageHelpRequested());
+  }
+
+  @ParameterizedTest
+  @ValueSource(strings = {"-v", "--version"})
+  void versionOptionIsRecognised(String option) {
+    CommandLine cmd = new CommandLine(new HopSearch());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs(option);
+
+    assertTrue(parseResult.isVersionHelpRequested());
+    assertFalse(parseResult.isUsageHelpRequested());
+  }
+}
diff --git 
a/plugins/misc/naming/src/main/java/org/apache/hop/naming/command/HopNamingCheck.java
 
b/plugins/misc/naming/src/main/java/org/apache/hop/naming/command/HopNamingCheck.java
index 0ea6f09b46..4496fef30b 100644
--- 
a/plugins/misc/naming/src/main/java/org/apache/hop/naming/command/HopNamingCheck.java
+++ 
b/plugins/misc/naming/src/main/java/org/apache/hop/naming/command/HopNamingCheck.java
@@ -59,10 +59,15 @@ import picocli.CommandLine.Option;
 @HopCommand(id = "naming-check", description = "Validate names against Naming 
Schemes")
 @Command(
     versionProvider = HopVersionProvider.class,
-    mixinStandardHelpOptions = true,
     description = "Validate names against project Naming Schemes")
 public class HopNamingCheck implements Runnable, IHopCommand, 
IHasHopMetadataProvider {
 
+  @Option(
+      names = {"-h", "--help"},
+      usageHelp = true,
+      description = "Displays this help message and quits.")
+  private boolean helpRequested;
+
   @Option(
       names = {"-v", "--version"},
       versionHelp = true,
diff --git 
a/plugins/misc/naming/src/test/java/org/apache/hop/naming/command/HopNamingCheckHelpOptionsTest.java
 
b/plugins/misc/naming/src/test/java/org/apache/hop/naming/command/HopNamingCheckHelpOptionsTest.java
new file mode 100644
index 0000000000..bfe613a8a5
--- /dev/null
+++ 
b/plugins/misc/naming/src/test/java/org/apache/hop/naming/command/HopNamingCheckHelpOptionsTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hop.naming.command;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import picocli.CommandLine;
+
+/** -h/--help and -v/--version must be recognised (#9268). */
+class HopNamingCheckHelpOptionsTest {
+
+  @ParameterizedTest
+  @ValueSource(strings = {"-h", "--help"})
+  void helpOptionIsRecognised(String option) {
+    CommandLine cmd = new CommandLine(new HopNamingCheck());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs(option);
+
+    assertTrue(parseResult.isUsageHelpRequested());
+    assertFalse(parseResult.isVersionHelpRequested());
+  }
+
+  @ParameterizedTest
+  @ValueSource(strings = {"-v", "--version"})
+  void versionOptionIsRecognised(String option) {
+    CommandLine cmd = new CommandLine(new HopNamingCheck());
+
+    CommandLine.ParseResult parseResult = cmd.parseArgs(option);
+
+    assertTrue(parseResult.isVersionHelpRequested());
+    assertFalse(parseResult.isUsageHelpRequested());
+  }
+}

Reply via email to