You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/10/19 20:39:40 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #9608: Using `usageHelp` instead of deprecated `help` in picocli commands

Jackie-Jiang commented on code in PR #9608:
URL: https://github.com/apache/pinot/pull/9608#discussion_r999911006


##########
pinot-tools/src/main/java/org/apache/pinot/tools/AutoAddInvertedIndexTool.java:
##########
@@ -66,23 +66,18 @@ public class AutoAddInvertedIndexTool extends AbstractBaseCommand implements Com
           + AutoAddInvertedIndex.DEFAULT_MAX_NUM_INVERTED_INDEX_ADDED)
   private int _maxNumInvertedIndex = AutoAddInvertedIndex.DEFAULT_MAX_NUM_INVERTED_INDEX_ADDED;
 
-  @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true,
+  @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, usageHelp = true,
       description = "Print this message.")
   private boolean _help = false;
 
   @Override
-  public boolean getHelp() {
-    return _help;
-  }
-
-  @Override
-  public String getName() {

Review Comment:
   Is this removed accidentally?



##########
pinot-perf/src/main/java/org/apache/pinot/perf/RawIndexBenchmark.java:
##########
@@ -303,6 +303,10 @@ public static void main(String[] args)
     RawIndexBenchmark benchmark = new RawIndexBenchmark();
     CommandLine commandLine = new CommandLine(benchmark);
     commandLine.parseArgs(args);
+    if (commandLine.isUsageHelpRequested() || commandLine.parseArgs(args).matchedArgs().size() == 0) {

Review Comment:
   Avoid parsing args twice



##########
pinot-tools/src/main/java/org/apache/pinot/tools/perf/PerfBenchmarkRunner.java:
##########
@@ -194,11 +194,6 @@ public static void main(String[] args)
     PerfBenchmarkRunner perfBenchmarkRunner = new PerfBenchmarkRunner();
     CommandLine commandLine = new CommandLine(perfBenchmarkRunner);
     commandLine.parseArgs(args);
-
-    if (perfBenchmarkRunner._help) {
-      perfBenchmarkRunner.printUsage();
-    } else {
-      perfBenchmarkRunner.execute();
-    }
+    commandLine.execute();

Review Comment:
   Follow the same convention



##########
pinot-tools/src/main/java/org/apache/pinot/tools/SegmentDumpTool.java:
##########
@@ -149,7 +146,14 @@ private void dumpStarTree()
 
   public static void main(String[] args)
       throws Exception {
-    new SegmentDumpTool().doMain(args);
+    SegmentDumpTool tool = new SegmentDumpTool();
+    CommandLine commandLine = new CommandLine(tool);
+    commandLine.parseArgs(args);

Review Comment:
   (minor) Move this into `else`, or try to match arguments similar to `RawIndexBenchmark`



##########
pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RealtimeProvisioningHelperCommand.java:
##########
@@ -345,4 +345,17 @@ private <T> T deserialize(File file, Class<T> clazz) {
           String.format("Cannot read schema file '%s' to '%s' object.", file, clazz.getSimpleName()), e);
     }
   }
+
+  public static void main(String[] args)
+      throws IOException {
+    RealtimeProvisioningHelperCommand rtProvisioningHelper = new RealtimeProvisioningHelperCommand();
+    CommandLine cmdLine = new CommandLine(rtProvisioningHelper);
+    cmdLine.parseArgs(args);
+    if (rtProvisioningHelper.getHelp()) {

Review Comment:
   Same here. Try to follow the same convention for all of them



-- 
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