jiameixie commented on pull request #8943: URL: https://github.com/apache/kafka/pull/8943#issuecomment-756586666
> The other tools (written by java) has similar issue. For example, `VerifiableConsumer` and `VerifiableProducer`. Could we have a helper method like `printHelpAndExitIfNeeded` to handle version for all tools (in `org.apache.kafka.tools`) @chia7712 `VerifiableConsumer` , ` producer-performance`and `VerifiableProducer` have different option arguments. So they can't share the same help method. Perhaps we can write a function get_version in ToolsUtils to get versionString. So it can be reused in all tools. Version info is used to instantiate ArgumentParser parse. version() is an action. What said in http://argparse4j.github.io/usage.html is : Arguments.version() prints version string specified by ArgumentParser.version() and exists when invoked: `191 /** Get the command-line argument parser. */ 192 private static ArgumentParser argParser() { 193 String version = AppInfoParser.getVersion(); 194 String commitId = AppInfoParser.getCommitId(); 195 String versionString = version + " " + "(" + "Commit:" + commitId + ")"; 196 ArgumentParser parser = ArgumentParsers 197 .newArgumentParser("producer-performance") 198 .version(versionString) 199 .defaultHelp(true) 200 .description("This tool is used to verify the producer performance."); ` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
