jack2012aa commented on code in PR #20619:
URL: https://github.com/apache/kafka/pull/20619#discussion_r2399338189


##########
tools/src/main/java/org/apache/kafka/tools/FeatureCommand.java:
##########
@@ -92,14 +92,27 @@ static void execute(String... args) throws Exception {
         addVersionMappingParser(subparsers);
         addFeatureDependenciesParser(subparsers);
 
-        Namespace namespace = parser.parseArgsOrFail(args);
+        Namespace namespace = parser.parseArgs(args);
         String command = namespace.getString("command");
+        if (command.equals("version-mapping")) {
+            handleVersionMapping(namespace, Feature.PRODUCTION_FEATURES);
+            return;
+        } else if (command.equals("feature-dependencies")) {
+            handleFeatureDependencies(namespace, Feature.PRODUCTION_FEATURES);
+            return;
+        }
         String configPath = namespace.getString("command_config");
         Properties properties = (configPath == null) ? new Properties() : 
Utils.loadProps(configPath);
 
-        CommandLineUtils.initializeBootstrapProperties(properties,
-            Optional.ofNullable(namespace.getString("bootstrap_server")),
-            Optional.ofNullable(namespace.getString("bootstrap_controller")));
+        try {
+            CommandLineUtils.initializeBootstrapProperties(properties,
+                    
Optional.ofNullable(namespace.getString("bootstrap_server")),
+                    
Optional.ofNullable(namespace.getString("bootstrap_controller")));
+        } catch (Exception e) {
+            // bootstrap_server and bootstrap_controller are in a mutually 
exclusive group,
+            // so the exception happens only when both of them are missing
+            throw new ArgumentParserException("one of the arguments 
--bootstrap-server --bootstrap-controller is required", parser);

Review Comment:
   Thanks for the review! Yes, it's better to use the existing message rather 
than write a new one. The code has been updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to