You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "walterddr (via GitHub)" <gi...@apache.org> on 2023/05/02 14:41:02 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #10672: Use the natively supported version and usage by picocli

walterddr commented on code in PR #10672:
URL: https://github.com/apache/pinot/pull/10672#discussion_r1182649913


##########
pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java:
##########
@@ -140,56 +142,71 @@ public class PinotAdministrator {
     SUBCOMMAND_MAP.put("FileSystem", new FileSystemCommand());
   }
 
-  @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false,
-      description = "Print this message.")
+  @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, description = "Print this message.")
   private boolean _help = false;
 
-  @CommandLine.Option(names = {"-version", "-v", "--v", "--version"}, required = false,
-      description = "Print the version of Pinot package.")
+  @CommandLine.Option(names = {"-version", "-v", "--v", "--version"}, required = false, description = "Print the "
+                                                                                                      + "version of "
+                                                                                                      + "Pinot "
+                                                                                                      + "package.")
   private boolean _version = false;
 
   private int _status = 1;
 
+  private final Writer _outWriter;
+
+  private final Versions _versions;
+
+  public PinotAdministrator(Writer outWriter, Versions versions) {
+    _outWriter = outWriter;
+    _versions = versions;
+  }
+
   public void execute(String[] args) {
     try {
-      CommandLine commandLine = new CommandLine(this);
-      for (Map.Entry<String, Command> subCommand : this.getSubCommands().entrySet()) {
-        commandLine.addSubcommand(subCommand.getKey(), subCommand.getValue());
-      }
-      CommandLine.ParseResult parseResult = commandLine.parseArgs(args);
-      // TODO: Use the natively supported version and usage by picocli
-      // see https://picocli.info/#_mixin_standard_help_options
-      if (!parseResult.hasSubcommand()) {
-        if (_version) {
-          printVersion();
-          _status = 0;
-        } else if (_help) {
-          printUsage();
-          _status = 0;
-        }
-      } else {
+      var commandLine = new CommandLine(this);

Review Comment:
   seems like we can't support var b/c of legacy JDK8 support :-(



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org