This is an automated email from the ASF dual-hosted git repository. gortiz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new a458426a32 Use Picocli to generate help (#14419) a458426a32 is described below commit a458426a3230d16687b4f011a8ee0fcd9d7ee957 Author: Rajat Venkatesh <1638298+vra...@users.noreply.github.com> AuthorDate: Tue Nov 12 13:19:59 2024 +0530 Use Picocli to generate help (#14419) Fix NPE and execution when --help was specified. Remove code that was supposed to generate help message. --- .../pinot/tools/AutoAddInvertedIndexTool.java | 11 +---- .../main/java/org/apache/pinot/tools/Command.java | 10 ++--- .../org/apache/pinot/tools/SegmentDumpTool.java | 11 +---- .../org/apache/pinot/tools/UpdateSegmentState.java | 11 +---- .../apache/pinot/tools/ValidateTableRetention.java | 11 +---- .../pinot/tools/admin/PinotAdministrator.java | 6 +++ .../command/AbstractDatabaseBaseAdminCommand.java | 9 ---- .../tools/admin/command/AddSchemaCommand.java | 2 +- .../pinot/tools/admin/command/AddTableCommand.java | 2 +- .../tools/admin/command/AddTenantCommand.java | 11 +---- .../tools/admin/command/AnonymizeDataCommand.java | 9 +--- .../admin/command/AvroSchemaToPinotSchema.java | 11 +---- .../tools/admin/command/BootstrapTableCommand.java | 11 +---- .../admin/command/ChangeNumReplicasCommand.java | 10 +---- .../tools/admin/command/ChangeTableState.java | 10 +---- .../tools/admin/command/CreateSegmentCommand.java | 11 +---- .../admin/command/DataImportDryRunCommand.java | 11 +---- .../tools/admin/command/DeleteClusterCommand.java | 11 +---- .../tools/admin/command/DeleteSchemaCommand.java | 2 +- .../tools/admin/command/DeleteTableCommand.java | 2 +- .../tools/admin/command/FileSystemCommand.java | 16 +------ .../tools/admin/command/GenerateDataCommand.java | 11 +---- .../command/GitHubEventsQuickStartCommand.java | 10 +---- .../tools/admin/command/ImportDataCommand.java | 15 +------ .../tools/admin/command/JsonToPinotSchema.java | 11 +---- .../command/LaunchDataIngestionJobCommand.java | 14 +----- .../LaunchSparkDataIngestionJobCommand.java | 14 +----- .../tools/admin/command/MoveReplicaGroup.java | 10 +---- .../OfflineSegmentIntervalCheckerCommand.java | 10 +---- .../admin/command/OperateClusterConfigCommand.java | 11 +---- .../tools/admin/command/PostQueryCommand.java | 11 +---- .../tools/admin/command/QuickStartCommand.java | 11 +---- .../command/RealtimeProvisioningHelperCommand.java | 10 +---- .../tools/admin/command/RebalanceTableCommand.java | 9 +--- .../command/SegmentProcessorFrameworkCommand.java | 10 +---- .../admin/command/ShowClusterInfoCommand.java | 11 +---- .../tools/admin/command/StartBrokerCommand.java | 9 +--- .../admin/command/StartControllerCommand.java | 10 +---- .../tools/admin/command/StartKafkaCommand.java | 11 +---- .../tools/admin/command/StartMinionCommand.java | 9 +--- .../tools/admin/command/StartServerCommand.java | 11 +---- .../admin/command/StartServiceManagerCommand.java | 14 +----- .../tools/admin/command/StartZookeeperCommand.java | 11 +---- .../tools/admin/command/StopProcessCommand.java | 11 +---- .../admin/command/StreamAvroIntoKafkaCommand.java | 11 +---- .../admin/command/StreamGitHubEventsCommand.java | 10 +---- .../tools/admin/command/UploadSegmentCommand.java | 11 +---- .../tools/admin/command/ValidateConfigCommand.java | 11 +---- .../admin/command/VerifyClusterStateCommand.java | 11 +---- .../tools/admin/command/VerifySegmentState.java | 10 +---- .../command/filesystem/BaseFileOperation.java | 5 --- .../tools/filesystem/PinotFSBenchmarkRunner.java | 11 +---- .../pinot/tools/perf/PerfBenchmarkRunner.java | 11 +---- .../org/apache/pinot/tools/perf/QueryRunner.java | 16 +------ .../converter/PinotSegmentConvertCommand.java | 11 +---- .../pinot/tools/admin/command/TestCommandHelp.java | 51 ++++++++++++++++++++++ 56 files changed, 112 insertions(+), 499 deletions(-) diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/AutoAddInvertedIndexTool.java b/pinot-tools/src/main/java/org/apache/pinot/tools/AutoAddInvertedIndexTool.java index 5ca98ff6d3..d0d82d4aa3 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/AutoAddInvertedIndexTool.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/AutoAddInvertedIndexTool.java @@ -23,7 +23,7 @@ import picocli.CommandLine; @SuppressWarnings("FieldCanBeLocal") -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class AutoAddInvertedIndexTool extends AbstractBaseCommand implements Command { @CommandLine.Option(names = {"-zkAddress"}, required = true, description = "Address of the Zookeeper (host:port)") private String _zkAddress; @@ -66,15 +66,6 @@ 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, usageHelp = true, - description = "Print this message.") - private boolean _help = false; - - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return getClass().getSimpleName(); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/Command.java b/pinot-tools/src/main/java/org/apache/pinot/tools/Command.java index 49b615b5e6..4c3b0d6bfc 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/Command.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/Command.java @@ -33,14 +33,10 @@ public interface Command extends Callable<Integer> { return execute() ? 0 : -1; } - public boolean execute() + boolean execute() throws Exception; - public void printUsage(); + void printUsage(); - public String description(); - - // Should return true if -help option is specified for the command, false otherwise. - // This is to facilitate PinotAdministrator to print help for individual commands. - public boolean getHelp(); + String description(); } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/SegmentDumpTool.java b/pinot-tools/src/main/java/org/apache/pinot/tools/SegmentDumpTool.java index ae42127d7a..46ca3bf6a4 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/SegmentDumpTool.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/SegmentDumpTool.java @@ -38,7 +38,7 @@ import org.apache.pinot.spi.utils.ReadMode; import picocli.CommandLine; -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class SegmentDumpTool extends AbstractBaseCommand implements Command { @CommandLine.Option(names = {"-path"}, required = true, description = "Path of the folder containing the segment" + " file") @@ -50,10 +50,6 @@ public class SegmentDumpTool extends AbstractBaseCommand implements Command { @CommandLine.Option(names = {"-dumpStarTree"}) private boolean _dumpStarTree = false; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, usageHelp = true, description = - "Print this message.") - private boolean _help = false; - private void dump() throws Exception { File indexDir = new File(_segmentDir); @@ -180,9 +176,4 @@ public class SegmentDumpTool extends AbstractBaseCommand implements Command { public String description() { return "Dump the segment content of the given path."; } - - @Override - public boolean getHelp() { - return _help; - } } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/UpdateSegmentState.java b/pinot-tools/src/main/java/org/apache/pinot/tools/UpdateSegmentState.java index 87699c9e4b..a3de33eebb 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/UpdateSegmentState.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/UpdateSegmentState.java @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class UpdateSegmentState extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(UpdateSegmentState.class); private static final String CMD_NAME = "UpdateSegmentState"; @@ -60,19 +60,10 @@ public class UpdateSegmentState extends AbstractBaseCommand implements Command { @CommandLine.Option(names = {"-fix"}, required = false, description = "Update IDEALSTATE values (OFFLINE->ONLINE).") private boolean _fix = false; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, usageHelp = true, - description = "Print this message.") - private boolean _help = false; - public UpdateSegmentState() { super(); } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return CMD_NAME; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/ValidateTableRetention.java b/pinot-tools/src/main/java/org/apache/pinot/tools/ValidateTableRetention.java index a766642298..48479dc9ae 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/ValidateTableRetention.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/ValidateTableRetention.java @@ -23,7 +23,7 @@ import picocli.CommandLine; @SuppressWarnings("FieldCanBeLocal") -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class ValidateTableRetention extends AbstractBaseCommand implements Command { @CommandLine.Option(names = {"-zkAddress"}, required = true, description = "Address of the Zookeeper (host:port)") private String _zkAddress; @@ -40,15 +40,6 @@ public class ValidateTableRetention extends AbstractBaseCommand implements Comma + " default: " + TableRetentionValidator.DEFAULT_DURATION_IN_DAYS_THRESHOLD) private long _durationInDaysThreshold = TableRetentionValidator.DEFAULT_DURATION_IN_DAYS_THRESHOLD; - @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() { return getClass().getSimpleName(); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java index 6226534367..b387f2cb60 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java @@ -18,6 +18,7 @@ */ package org.apache.pinot.tools.admin; +import com.google.common.annotations.VisibleForTesting; import java.util.HashMap; import java.util.Map; import org.apache.pinot.common.Utils; @@ -198,6 +199,11 @@ public class PinotAdministrator { return SUBCOMMAND_MAP; } + @VisibleForTesting + public int getStatus() { + return _status; + } + public static void main(String[] args) { PluginManager.get().init(); PinotAdministrator pinotAdministrator = new PinotAdministrator(); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractDatabaseBaseAdminCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractDatabaseBaseAdminCommand.java index 5cd303aa5b..4014aab8a2 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractDatabaseBaseAdminCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AbstractDatabaseBaseAdminCommand.java @@ -67,10 +67,6 @@ public abstract class AbstractDatabaseBaseAdminCommand extends AbstractBaseAdmin @CommandLine.Option(names = {"-database"}, required = false, description = "Corresponding database.") protected String _database; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, description = "Print " - + "this message.") - private boolean _help = false; - public AbstractDatabaseBaseAdminCommand setControllerHost(String controllerHost) { _controllerHost = controllerHost; return this; @@ -131,11 +127,6 @@ public abstract class AbstractDatabaseBaseAdminCommand extends AbstractBaseAdmin return this; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String toString() { String retString = diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddSchemaCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddSchemaCommand.java index acfc1979d0..03e4a611e1 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddSchemaCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddSchemaCommand.java @@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "AddSchema") +@CommandLine.Command(name = "AddSchema", mixinStandardHelpOptions = true) public class AddSchemaCommand extends AbstractDatabaseBaseAdminCommand { private static final Logger LOGGER = LoggerFactory.getLogger(AddSchemaCommand.class); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTableCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTableCommand.java index 389a1463f6..00da0838ff 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTableCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTableCommand.java @@ -40,7 +40,7 @@ import picocli.CommandLine; * Class to implement CreateResource command. * */ -@CommandLine.Command(name = "AddTable") +@CommandLine.Command(name = "AddTable", mixinStandardHelpOptions = true) public class AddTableCommand extends AbstractDatabaseBaseAdminCommand { private static final Logger LOGGER = LoggerFactory.getLogger(AddTableCommand.class); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java index 288bc70b0f..f88055cd75 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "AddTenant") +@CommandLine.Command(name = "AddTenant", mixinStandardHelpOptions = true) public class AddTenantCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(AddTenantCommand.class); @@ -76,10 +76,6 @@ public class AddTenantCommand extends AbstractBaseAdminCommand implements Comman @CommandLine.Option(names = {"-authTokenUrl"}, required = false, description = "Http auth token url.") private String _authTokenUrl; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - private String _controllerAddress; private AuthProvider _authProvider; @@ -176,11 +172,6 @@ public class AddTenantCommand extends AbstractBaseAdminCommand implements Comman return "AddTenant"; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String toString() { String retString = ("AddTenant -controllerProtocol " + _controllerProtocol + " -controllerHost " + _controllerHost diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AnonymizeDataCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AnonymizeDataCommand.java index 89bb13430d..bf1f01d439 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AnonymizeDataCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AnonymizeDataCommand.java @@ -31,7 +31,7 @@ import picocli.CommandLine; @SuppressWarnings({"FieldCanBeLocal", "unused"}) -@CommandLine.Command(name = "AnonymizeData") +@CommandLine.Command(name = "AnonymizeData", mixinStandardHelpOptions = true) public class AnonymizeDataCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(AnonymizeDataCommand.class); @@ -77,13 +77,6 @@ public class AnonymizeDataCommand extends AbstractBaseAdminCommand implements Co + " but with additional heap overhead. True by default") private boolean _mapBasedGlobalDictionaries = true; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message") - private boolean _help = false; - - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "AnonymizeData"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AvroSchemaToPinotSchema.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AvroSchemaToPinotSchema.java index 031e0a5ac3..142bd9c99b 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AvroSchemaToPinotSchema.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AvroSchemaToPinotSchema.java @@ -42,7 +42,7 @@ import picocli.CommandLine; * automatically do this, the intention is to get most of the work done by this class, and require any * manual editing on top. */ -@CommandLine.Command(name = "AvroSchemaToPinotSchema") +@CommandLine.Command(name = "AvroSchemaToPinotSchema", mixinStandardHelpOptions = true) public class AvroSchemaToPinotSchema extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(AvroSchemaToPinotSchema.class); @@ -86,10 +86,6 @@ public class AvroSchemaToPinotSchema extends AbstractBaseAdminCommand implements + "JSON string, can be NONE/NON_PRIMITIVE/ALL") String _collectionNotUnnestedToJson; - @SuppressWarnings("FieldCanBeLocal") - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - @Override public boolean execute() throws Exception { @@ -132,11 +128,6 @@ public class AvroSchemaToPinotSchema extends AbstractBaseAdminCommand implements return "Extracting Pinot schema file from Avro schema or data file."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String toString() { return "AvroSchemaToPinotSchema -avroSchemaFile " + _avroSchemaFile + " -avroDataFile " + _avroDataFile diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/BootstrapTableCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/BootstrapTableCommand.java index a7afc3d99e..9e51935b0b 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/BootstrapTableCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/BootstrapTableCommand.java @@ -63,7 +63,7 @@ import picocli.CommandLine; * <table_name>/rawdata/... * ``` */ -@CommandLine.Command(name = "BootstrapTable") +@CommandLine.Command(name = "BootstrapTable", mixinStandardHelpOptions = true) public class BootstrapTableCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(BootstrapTableCommand.class.getName()); @@ -92,17 +92,8 @@ public class BootstrapTableCommand extends AbstractBaseAdminCommand implements C @CommandLine.Option(names = {"-authTokenUrl"}, required = false, description = "Http auth token url.") private String _authTokenUrl; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - private AuthProvider _authProvider; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "BootstrapTable"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeNumReplicasCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeNumReplicasCommand.java index c173edc2f5..d334fa523f 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeNumReplicasCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeNumReplicasCommand.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "ChangeNumReplicas") +@CommandLine.Command(name = "ChangeNumReplicas", mixinStandardHelpOptions = true) public class ChangeNumReplicasCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(ChangeNumReplicasCommand.class); @@ -42,14 +42,6 @@ public class ChangeNumReplicasCommand extends AbstractBaseAdminCommand implement @CommandLine.Option(names = {"-exec"}, required = false, description = "Execute command (Run the replica changer)") private boolean _exec; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "ChangeNumReplicas"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeTableState.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeTableState.java index 25cf1e5fbf..8a7916344c 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeTableState.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ChangeTableState.java @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "ChangeTableState") +@CommandLine.Command(name = "ChangeTableState", mixinStandardHelpOptions = true) public class ChangeTableState extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(ChangeTableState.class); @@ -66,10 +66,6 @@ public class ChangeTableState extends AbstractBaseAdminCommand implements Comman @CommandLine.Option(names = {"-authTokenUrl"}, required = false, description = "Http auth token url.") private String _authTokenUrl; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - private AuthProvider _authProvider; public ChangeTableState setAuthProvider(AuthProvider authProvider) { @@ -114,10 +110,6 @@ public class ChangeTableState extends AbstractBaseAdminCommand implements Comman return "Change the state (enable|disable|drop) of Pinot table"; } - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "ChangeTableState"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/CreateSegmentCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/CreateSegmentCommand.java index 4263f4bbbe..ad39cbcce0 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/CreateSegmentCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/CreateSegmentCommand.java @@ -49,7 +49,7 @@ import picocli.CommandLine; * Class to implement CreateSegment command. */ @SuppressWarnings("unused") -@CommandLine.Command(name = "CreateSegment") +@CommandLine.Command(name = "CreateSegment", mixinStandardHelpOptions = true) public class CreateSegmentCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(CreateSegmentCommand.class); @@ -90,10 +90,6 @@ public class CreateSegmentCommand extends AbstractBaseAdminCommand implements Co @CommandLine.Option(names = {"-numThreads"}, description = "Parallelism while generating segments, default is 1.") private int _numThreads = 1; - @SuppressWarnings("FieldCanBeLocal") - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - public CreateSegmentCommand setDataDir(String dataDir) { _dataDir = dataDir; return this; @@ -168,11 +164,6 @@ public class CreateSegmentCommand extends AbstractBaseAdminCommand implements Co return "Create pinot segments from the provided data files."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public boolean execute() throws Exception { diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DataImportDryRunCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DataImportDryRunCommand.java index 0047806e00..cb7917646b 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DataImportDryRunCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DataImportDryRunCommand.java @@ -37,7 +37,7 @@ import picocli.CommandLine; * Class for command to do a dry run of data ingestion so that we can see how transformation functions and * complex config will be applied. */ -@CommandLine.Command(name = "DataImportDryRun") +@CommandLine.Command(name = "DataImportDryRun", mixinStandardHelpOptions = true) public class DataImportDryRunCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(DataImportDryRunCommand.class); @@ -47,10 +47,6 @@ public class DataImportDryRunCommand extends AbstractBaseAdminCommand implements @CommandLine.Option(names = {"-tableConfigFile"}, required = true, description = "Path to table config file.") String _tableConfigFile; - @SuppressWarnings("FieldCanBeLocal") - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - @Override public boolean execute() throws Exception { JSONRecordReader jsonRecordReader = new JSONRecordReader(); @@ -83,9 +79,4 @@ public class DataImportDryRunCommand extends AbstractBaseAdminCommand implements public String description() { return "Dry run of data import"; } - - @Override - public boolean getHelp() { - return _help; - } } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteClusterCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteClusterCommand.java index 54ffc73ca8..a191ae8114 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteClusterCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteClusterCommand.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "DeleteCluster") +@CommandLine.Command(name = "DeleteCluster", mixinStandardHelpOptions = true) public class DeleteClusterCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(DeleteClusterCommand.class); @@ -35,10 +35,6 @@ public class DeleteClusterCommand extends AbstractBaseAdminCommand implements Co @CommandLine.Option(names = {"-zkAddress"}, required = false, description = "Http address of Zookeeper.") private String _zkAddress = DEFAULT_ZK_ADDRESS; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @Override public String toString() { return ("DeleteCluster -clusterName " + _clusterName + " -zkAddress " + _zkAddress); @@ -49,11 +45,6 @@ public class DeleteClusterCommand extends AbstractBaseAdminCommand implements Co return "Remove the Pinot Cluster from Helix."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "DeleteCluster"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteSchemaCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteSchemaCommand.java index 437111e5d3..c5933806cb 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteSchemaCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteSchemaCommand.java @@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "DeleteSchema") +@CommandLine.Command(name = "DeleteSchema", mixinStandardHelpOptions = true) public class DeleteSchemaCommand extends AbstractDatabaseBaseAdminCommand { private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSchemaCommand.class); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteTableCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteTableCommand.java index e6abc1842d..885c5afc3e 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteTableCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/DeleteTableCommand.java @@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "DeleteTable") +@CommandLine.Command(name = "DeleteTable", mixinStandardHelpOptions = true) public class DeleteTableCommand extends AbstractDatabaseBaseAdminCommand { private static final Logger LOGGER = LoggerFactory.getLogger(DeleteTableCommand.class); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/FileSystemCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/FileSystemCommand.java index e6df8bbe54..10a2c77b8e 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/FileSystemCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/FileSystemCommand.java @@ -35,7 +35,7 @@ import picocli.CommandLine; CopyFiles.class, MoveFiles.class, DeleteFiles.class -}) +}, mixinStandardHelpOptions = true) public class FileSystemCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(FileSystemCommand.class.getName()); @@ -43,10 +43,6 @@ public class FileSystemCommand extends AbstractBaseAdminCommand implements Comma CommandLine.ScopeType.INHERIT, description = "PinotFS Config file.") private String _configFile; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, usageHelp = true, description = "Print this message.", - scope = CommandLine.ScopeType.INHERIT) - private boolean _help = false; - @CommandLine.Parameters private String[] _parameters; @@ -55,11 +51,6 @@ public class FileSystemCommand extends AbstractBaseAdminCommand implements Comma return this; } - public FileSystemCommand setHelp(boolean help) { - _help = help; - return this; - } - public String getConfigFile() { return _configFile; } @@ -69,11 +60,6 @@ public class FileSystemCommand extends AbstractBaseAdminCommand implements Comma return this; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "FileSystem"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GenerateDataCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GenerateDataCommand.java index 6d6a87d0c7..efcc130188 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GenerateDataCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GenerateDataCommand.java @@ -42,7 +42,7 @@ import picocli.CommandLine; * Class to implement GenerateData command. * */ -@CommandLine.Command(name = "GenerateData") +@CommandLine.Command(name = "GenerateData", mixinStandardHelpOptions = true) public class GenerateDataCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(GenerateDataCommand.class); @@ -69,19 +69,10 @@ public class GenerateDataCommand extends AbstractBaseAdminCommand implements Com @CommandLine.Option(names = {"-overwrite"}, required = false, description = "Overwrite, if directory exists") boolean _overwrite; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @CommandLine.Option(names = {"-format"}, required = false, help = true, description = "Output format ('AVRO' or 'CSV' or 'JSON').") private String _format = FORMAT_AVRO; - @Override - public boolean getHelp() { - return _help; - } - public void init(int numRecords, int numFiles, String schemaFile, String outDir) { _numRecords = numRecords; _numFiles = numFiles; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GitHubEventsQuickStartCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GitHubEventsQuickStartCommand.java index e4cc73d453..f2c1b4fd99 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GitHubEventsQuickStartCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/GitHubEventsQuickStartCommand.java @@ -27,7 +27,7 @@ import picocli.CommandLine; /** * Command to run GitHubEventsQuickStart */ -@CommandLine.Command(name = "GitHubEventsQuickStart") +@CommandLine.Command(name = "GitHubEventsQuickStart", mixinStandardHelpOptions = true) public class GitHubEventsQuickStartCommand extends AbstractBaseAdminCommand implements Command { @CommandLine.Option(names = {"-personalAccessToken"}, required = true, description = "GitHub personal access token.") @@ -37,9 +37,6 @@ public class GitHubEventsQuickStartCommand extends AbstractBaseAdminCommand impl description = "Stream DataSource to use for ingesting data. Supported values - Kafka,Kinesis") private String _sourceType; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - public void setPersonalAccessToken(String personalAccessToken) { _personalAccessToken = personalAccessToken; } @@ -48,11 +45,6 @@ public class GitHubEventsQuickStartCommand extends AbstractBaseAdminCommand impl _sourceType = sourceType; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "GitHubEventsQuickStart"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ImportDataCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ImportDataCommand.java index 60414ee08e..611e470f84 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ImportDataCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ImportDataCommand.java @@ -56,7 +56,7 @@ import picocli.CommandLine; * Class to implement ImportData command. */ @SuppressWarnings("unused") -@CommandLine.Command(name = "ImportData") +@CommandLine.Command(name = "ImportData", mixinStandardHelpOptions = true) public class ImportDataCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(ImportDataCommand.class); private static final String SEGMENT_NAME = "segment.name"; @@ -97,10 +97,6 @@ public class ImportDataCommand extends AbstractBaseAdminCommand implements Comma @CommandLine.Option(names = {"-additionalConfigs"}, arity = "1..*", description = "Additional configs to be set.") private List<String> _additionalConfigs; - @SuppressWarnings("FieldCanBeLocal") - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - private AuthProvider _authProvider; public ImportDataCommand setDataFilePath(String dataFilePath) { @@ -121,10 +117,6 @@ public class ImportDataCommand extends AbstractBaseAdminCommand implements Comma _segmentNameGeneratorType = segmentNameGeneratorType; } - public void setHelp(boolean help) { - _help = help; - } - public ImportDataCommand setTable(String table) { _table = table; return this; @@ -205,11 +197,6 @@ public class ImportDataCommand extends AbstractBaseAdminCommand implements Comma return "Insert data into Pinot cluster."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public boolean execute() throws IOException { diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/JsonToPinotSchema.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/JsonToPinotSchema.java index a06a89eb06..4e534c9e92 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/JsonToPinotSchema.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/JsonToPinotSchema.java @@ -42,7 +42,7 @@ import picocli.CommandLine; * automatically do this, the intention is to get most of the work done by this class, and require any * manual editing on top. */ -@CommandLine.Command(name = "JsonToPinotSchema") +@CommandLine.Command(name = "JsonToPinotSchema", mixinStandardHelpOptions = true) public class JsonToPinotSchema extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(JsonToPinotSchema.class); @@ -78,10 +78,6 @@ public class JsonToPinotSchema extends AbstractBaseAdminCommand implements Comma + "JSON string, can be NONE/NON_PRIMITIVE/ALL") String _collectionNotUnnestedToJson; - @SuppressWarnings("FieldCanBeLocal") - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - @Override public boolean execute() throws Exception { @@ -116,11 +112,6 @@ public class JsonToPinotSchema extends AbstractBaseAdminCommand implements Comma return "Extracting Pinot schema file from JSON data file."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String toString() { return "JsonToPinotSchema -jsonFile " + _jsonFile + " -outputDir " + _outputDir + " -pinotSchemaName " diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java index bca3c1a93c..d4f9788fc5 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchDataIngestionJobCommand.java @@ -39,12 +39,9 @@ import picocli.CommandLine; * Class to implement LaunchDataIngestionJob command. * */ -@CommandLine.Command(name = "LaunchDataIngestionJob") +@CommandLine.Command(name = "LaunchDataIngestionJob", mixinStandardHelpOptions = true) public class LaunchDataIngestionJobCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(LaunchDataIngestionJobCommand.class); - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; @CommandLine.Option(names = {"-jobSpecFile", "-jobSpec"}, required = true, description = "Ingestion job spec file") private String _jobSpecFile; @@ -93,15 +90,6 @@ public class LaunchDataIngestionJobCommand extends AbstractBaseAdminCommand impl _authProvider = authProvider; } - @Override - public boolean getHelp() { - return _help; - } - - public void setHelp(boolean help) { - _help = help; - } - @Override public boolean execute() throws Exception { diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchSparkDataIngestionJobCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchSparkDataIngestionJobCommand.java index df3e852afe..3ebfa561ac 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchSparkDataIngestionJobCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/LaunchSparkDataIngestionJobCommand.java @@ -50,7 +50,7 @@ import picocli.CommandLine; * Class to implement LaunchDataIngestionJob command. * */ -@CommandLine.Command(name = "LaunchSparkDataIngestionJob") +@CommandLine.Command(name = "LaunchSparkDataIngestionJob", mixinStandardHelpOptions = true) public class LaunchSparkDataIngestionJobCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(LaunchSparkDataIngestionJobCommand.class); public static final String MAIN_CLASS = "org.apache.pinot.tools.admin.command.LaunchDataIngestionJobCommand"; @@ -59,9 +59,6 @@ public class LaunchSparkDataIngestionJobCommand extends AbstractBaseAdminCommand public static final String LOCAL_FILE_PREFIX = "local://"; public static final String PINOT_MAIN_JAR_PREFIX = "pinot-all"; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, description = "Print " - + "this message.") - private boolean _help = false; @CommandLine.Option(names = {"-jobSpecFile", "-jobSpec"}, required = true, description = "Ingestion job spec file") private String _jobSpecFile; @CommandLine.Option(names = {"-values"}, required = false, arity = "1..*", description = "Context values set to the" @@ -130,15 +127,6 @@ public class LaunchSparkDataIngestionJobCommand extends AbstractBaseAdminCommand _authProvider = authProvider; } - @Override - public boolean getHelp() { - return _help; - } - - public void setHelp(boolean help) { - _help = help; - } - @Override public boolean execute() throws Exception { diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/MoveReplicaGroup.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/MoveReplicaGroup.java index 4ece1f5abf..b7d1754b9b 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/MoveReplicaGroup.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/MoveReplicaGroup.java @@ -60,7 +60,7 @@ import picocli.CommandLine; * This command is intended to be run multiple times to migrate all the replicas of a table to the destination * servers (if intended). */ -@CommandLine.Command(name = "MoveReplicaGroup") +@CommandLine.Command(name = "MoveReplicaGroup", mixinStandardHelpOptions = true) public class MoveReplicaGroup extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(MoveReplicaGroup.class); @@ -92,17 +92,9 @@ public class MoveReplicaGroup extends AbstractBaseAdminCommand implements Comman description = "Execute replica group move. dryRun(default) if not specified") private boolean _exec = false; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, description = "Prints help") - private boolean _help = false; - private ZKHelixAdmin _helix; private PinotZKChanger _zkChanger; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "MoveReplicaGroup"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OfflineSegmentIntervalCheckerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OfflineSegmentIntervalCheckerCommand.java index 1dca8d95ff..92f969175c 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OfflineSegmentIntervalCheckerCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OfflineSegmentIntervalCheckerCommand.java @@ -42,7 +42,7 @@ import picocli.CommandLine; /** * Pinot admin command to list all offline segments with invalid intervals, group by table name */ -@CommandLine.Command(name = "OfflineSegmentIntervalChecker") +@CommandLine.Command(name = "OfflineSegmentIntervalChecker", mixinStandardHelpOptions = true) public class OfflineSegmentIntervalCheckerCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(OfflineSegmentIntervalCheckerCommand.class); @@ -58,14 +58,6 @@ public class OfflineSegmentIntervalCheckerCommand extends AbstractBaseAdminComma description = "Comma separated list of tables to check for invalid segment intervals") private String _tableNames; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - - @Override - public boolean getHelp() { - return _help; - } - @Override public String toString() { return "OfflineSegmentIntervalChecker"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OperateClusterConfigCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OperateClusterConfigCommand.java index 0e1e3ad68e..7c034d0e88 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OperateClusterConfigCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/OperateClusterConfigCommand.java @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "OperateClusterConfig") +@CommandLine.Command(name = "OperateClusterConfig", mixinStandardHelpOptions = true) public class OperateClusterConfigCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(OperateClusterConfigCommand.class.getName()); @@ -67,17 +67,8 @@ public class OperateClusterConfigCommand extends AbstractBaseAdminCommand implem description = "Operation to take for Cluster config, currently support GET/ADD/UPDATE/DELETE.") private String _operation; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - private AuthProvider _authProvider; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "DeleteClusterConfig"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/PostQueryCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/PostQueryCommand.java index a0857dc949..d0e281132c 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/PostQueryCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/PostQueryCommand.java @@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "PostQuery") +@CommandLine.Command(name = "PostQuery", mixinStandardHelpOptions = true) public class PostQueryCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(PostQueryCommand.class.getName()); @@ -60,20 +60,11 @@ public class PostQueryCommand extends AbstractBaseAdminCommand implements Comman @CommandLine.Option(names = {"-authTokenUrl"}, required = false, description = "Http auth token url.") private String _authTokenUrl; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, description = "Print " - + "this message.") - private boolean _help = false; - @CommandLine.Option(names = {"-o", "-option"}, required = false, description = "Additional options '-o key=value'") private Map<String, String> _additionalOptions = new HashMap<>(); private AuthProvider _authProvider; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "PostQuery"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java index 1578814985..9a4d12a727 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "QuickStart") +@CommandLine.Command(name = "QuickStart", mixinStandardHelpOptions = true) public class QuickStartCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(QuickStartCommand.class.getName()); @@ -55,15 +55,6 @@ public class QuickStartCommand extends AbstractBaseAdminCommand implements Comma description = "Config file path to override default pinot configs") private String _configFilePath; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, - description = "Print this message.") - private boolean _help = false; - - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "QuickStart"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RealtimeProvisioningHelperCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RealtimeProvisioningHelperCommand.java index 330e30992c..2e60a43431 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RealtimeProvisioningHelperCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RealtimeProvisioningHelperCommand.java @@ -43,7 +43,7 @@ import picocli.CommandLine; * Given a set of input params, output a table of num hosts to num hours and the memory required per host * */ -@CommandLine.Command(name = "RealtimeProvisioningHelper") +@CommandLine.Command(name = "RealtimeProvisioningHelper", mixinStandardHelpOptions = true) public class RealtimeProvisioningHelperCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(RealtimeProvisioningHelperCommand.class); @@ -103,9 +103,6 @@ public class RealtimeProvisioningHelperCommand extends AbstractBaseAdminCommand description = "Maximum memory per host that can be used for pinot data (e.g. 250G, 100M). Default 48g") private String _maxUsableHostMemory = "48G"; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, usageHelp = true) - private boolean _help = false; - public RealtimeProvisioningHelperCommand setTableConfigFile(String tableConfigFile) { _tableConfigFile = tableConfigFile; return this; @@ -188,11 +185,6 @@ public class RealtimeProvisioningHelperCommand extends AbstractBaseAdminCommand + "generated and used for memory estimation."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public void printExamples() { StringBuilder builder = new StringBuilder(); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RebalanceTableCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RebalanceTableCommand.java index 97f59bc08b..5a9d9b0087 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RebalanceTableCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/RebalanceTableCommand.java @@ -32,7 +32,7 @@ import picocli.CommandLine; * A sub-command for pinot-admin tool to rebalance a specific table */ @SuppressWarnings({"FieldCanBeLocal", "unused"}) -@CommandLine.Command(name = "RebalanceTable") +@CommandLine.Command(name = "RebalanceTable", mixinStandardHelpOptions = true) public class RebalanceTableCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(RebalanceTableCommand.class); @@ -95,13 +95,6 @@ public class RebalanceTableCommand extends AbstractBaseAdminCommand implements C private long _externalViewStabilizationTimeoutInMs = RebalanceConfig.DEFAULT_EXTERNAL_VIEW_STABILIZATION_TIMEOUT_IN_MS; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message") - private boolean _help = false; - - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "RebalanceTable"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/SegmentProcessorFrameworkCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/SegmentProcessorFrameworkCommand.java index 807d3cea9a..30762951f4 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/SegmentProcessorFrameworkCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/SegmentProcessorFrameworkCommand.java @@ -43,7 +43,7 @@ import picocli.CommandLine; /** * Command to run {@link org.apache.pinot.core.segment.processing.framework.SegmentProcessorFramework} */ -@CommandLine.Command(name = "SegmentProcessorFramework") +@CommandLine.Command(name = "SegmentProcessorFramework", mixinStandardHelpOptions = true) public class SegmentProcessorFrameworkCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(SegmentProcessorFrameworkCommand.class); @@ -52,14 +52,6 @@ public class SegmentProcessorFrameworkCommand extends AbstractBaseAdminCommand i description = "Path to SegmentProcessorFrameworkSpec json file") private String _segmentProcessorFrameworkSpec; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "SegmentProcessorFramework"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ShowClusterInfoCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ShowClusterInfoCommand.java index 9b8753f7ac..1a94488605 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ShowClusterInfoCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ShowClusterInfoCommand.java @@ -48,7 +48,7 @@ import org.yaml.snakeyaml.Yaml; import picocli.CommandLine; -@CommandLine.Command(name = "ShowClusterInfo") +@CommandLine.Command(name = "ShowClusterInfo", mixinStandardHelpOptions = true) public class ShowClusterInfoCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(ShowClusterInfoCommand.class.getName()); @@ -64,10 +64,6 @@ public class ShowClusterInfoCommand extends AbstractBaseAdminCommand implements @CommandLine.Option(names = {"-tags"}, required = false, description = "Commaa separated tag names.") private String _tags = ""; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @Override public boolean execute() throws Exception { @@ -192,11 +188,6 @@ public class ShowClusterInfoCommand extends AbstractBaseAdminCommand implements return "Show Pinot Cluster information."; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String toString() { return ("ShowClusterInfo -clusterName " + _clusterName + " -zkAddress " + _zkAddress + " -tables " + _tables diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java index 1749d256e5..9ec09f9c78 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java @@ -38,12 +38,9 @@ import picocli.CommandLine; * Class to implement StartBroker command. * */ -@CommandLine.Command(name = "StartBroker") +@CommandLine.Command(name = "StartBroker", mixinStandardHelpOptions = true) public class StartBrokerCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartBrokerCommand.class); - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; @CommandLine.Option(names = {"-brokerHost"}, required = false, description = "host name for broker.") private String _brokerHost; @@ -70,10 +67,6 @@ public class StartBrokerCommand extends AbstractBaseAdminCommand implements Comm description = "Proxy config overrides") private Map<String, Object> _configOverrides = new HashMap<>(); - public boolean getHelp() { - return _help; - } - public String getBrokerHost() { return _brokerHost; } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java index 0ab4744ed3..bdf795c37b 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java @@ -38,16 +38,13 @@ import picocli.CommandLine; * Class to implement StartController command. * */ -@CommandLine.Command(name = "StartController") +@CommandLine.Command(name = "StartController", mixinStandardHelpOptions = true) public class StartControllerCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartControllerCommand.class); @CommandLine.Option(names = {"-controllerMode"}, description = "Pinot controller mode.") private ControllerConf.ControllerMode _controllerMode = ControllerConf.ControllerMode.DUAL; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, description = "Print this message.") - private boolean _help = false; - @CommandLine.Option(names = {"-controllerHost"}, required = false, description = "host name for controller.") private String _controllerHost; @@ -76,11 +73,6 @@ public class StartControllerCommand extends AbstractBaseAdminCommand implements @CommandLine.Option(names = {"-configOverride"}, required = false, split = ",") private Map<String, Object> _configOverrides = new HashMap<>(); - @Override - public boolean getHelp() { - return _help; - } - public ControllerConf.ControllerMode getControllerMode() { return _controllerMode; } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java index 9dd466b82e..e4dd36070e 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java @@ -33,17 +33,13 @@ import picocli.CommandLine; /** * Class for command to start Kafka. */ -@CommandLine.Command(name = "StartKafka") +@CommandLine.Command(name = "StartKafka", mixinStandardHelpOptions = true) public class StartKafkaCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartKafkaCommand.class); @CommandLine.Option(names = {"-port"}, required = false, description = "Port to start Kafka server on.") private int _port = KafkaStarterUtils.DEFAULT_KAFKA_PORT; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @CommandLine.Option(names = {"-brokerId"}, required = false, description = "Kafka broker ID.") private int _brokerId = KafkaStarterUtils.DEFAULT_BROKER_ID; @@ -51,11 +47,6 @@ public class StartKafkaCommand extends AbstractBaseAdminCommand implements Comma private String _zkAddress = KafkaStarterUtils.getDefaultKafkaZKAddress(); private StreamDataServerStartable _kafkaStarter; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "StartKafka"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java index dd8d574ac1..a754a05a54 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java @@ -38,12 +38,9 @@ import picocli.CommandLine; * Class to implement StartMinion command. * */ -@CommandLine.Command(name = "StartMinion") +@CommandLine.Command(name = "StartMinion", mixinStandardHelpOptions = true) public class StartMinionCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartMinionCommand.class); - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; @CommandLine.Option(names = {"-minionHost"}, required = false, description = "Host name for minion.") private String _minionHost; @CommandLine.Option(names = {"-minionPort"}, required = false, description = "Port number to start the minion at.") @@ -64,10 +61,6 @@ public class StartMinionCommand extends AbstractBaseAdminCommand implements Comm return this; } - public boolean getHelp() { - return _help; - } - public String getMinionHost() { return _minionHost; } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java index e7d87aa0a8..e091f88de0 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java @@ -38,13 +38,9 @@ import picocli.CommandLine; * Class to implement StartServer command. * */ -@CommandLine.Command(name = "StartServer") +@CommandLine.Command(name = "StartServer", mixinStandardHelpOptions = true) public class StartServerCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartServerCommand.class); - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @CommandLine.Option(names = {"-serverHost"}, required = false, description = "Host name for server.") private String _serverHost; @@ -88,11 +84,6 @@ public class StartServerCommand extends AbstractBaseAdminCommand implements Comm @CommandLine.Option(names = {"-configOverride"}, required = false, split = ",") private Map<String, Object> _configOverrides = new HashMap<>(); - @Override - public boolean getHelp() { - return _help; - } - public String getServerHost() { return _serverHost; } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java index c81db40c46..05e50d498a 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java @@ -52,7 +52,7 @@ import static org.apache.pinot.spi.utils.CommonConstants.Helix.PINOT_SERVICE_ROL * <li>All remaining bootstrap services in parallel</li> * </ol> */ -@CommandLine.Command(name = "StartServiceManager") +@CommandLine.Command(name = "StartServiceManager", mixinStandardHelpOptions = true) public class StartServiceManagerCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartServiceManagerCommand.class); private static final long START_TICK = System.nanoTime(); @@ -60,9 +60,6 @@ public class StartServiceManagerCommand extends AbstractBaseAdminCommand impleme // multiple instances allowed per role for testing many minions private final List<Entry<ServiceRole, Map<String, Object>>> _bootstrapConfigurations = new ArrayList<>(); - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help; @CommandLine.Option(names = {"-zkAddress"}, required = false, description = "Http address of Zookeeper.") // TODO: support forbids = {"-bootstrapConfigPaths", "-bootstrapServices"}) private String _zkAddress = DEFAULT_ZK_ADDRESS; @@ -130,15 +127,6 @@ public class StartServiceManagerCommand extends AbstractBaseAdminCommand impleme return this; } - @Override - public boolean getHelp() { - return _help; - } - - public void setHelp(boolean help) { - _help = help; - } - @Override public String getName() { return "StartPinotService"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java index 21cbeb452c..1d6287edfa 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java @@ -34,7 +34,7 @@ import picocli.CommandLine; * * */ -@CommandLine.Command(name = "StartZookeeper") +@CommandLine.Command(name = "StartZookeeper", mixinStandardHelpOptions = true) public class StartZookeeperCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StartZookeeperCommand.class); @@ -44,15 +44,6 @@ public class StartZookeeperCommand extends AbstractBaseAdminCommand implements C @CommandLine.Option(names = {"-dataDir"}, required = false, description = "Directory for zookeper data.") private String _dataDir = PinotConfigUtils.TMP_DIR + "PinotAdmin/zkData"; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "StartZookeeper"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StopProcessCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StopProcessCommand.java index ffb5d7c0b7..4b0ac67088 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StopProcessCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StopProcessCommand.java @@ -37,7 +37,7 @@ import picocli.CommandLine; * * */ -@CommandLine.Command(name = "StopProcess") +@CommandLine.Command(name = "StopProcess", mixinStandardHelpOptions = true) public class StopProcessCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StopProcessCommand.class); @@ -56,10 +56,6 @@ public class StopProcessCommand extends AbstractBaseAdminCommand implements Comm @CommandLine.Option(names = {"-kafka"}, required = false, description = "Stop the Kafka process.") private boolean _kafka = false; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Stop the PinotServer.") - private boolean _help = false; - public StopProcessCommand() { } @@ -173,11 +169,6 @@ public class StopProcessCommand extends AbstractBaseAdminCommand implements Comm return ret; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "StopProcess"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamAvroIntoKafkaCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamAvroIntoKafkaCommand.java index 8eb2c06b9d..114a6a4fa6 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamAvroIntoKafkaCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamAvroIntoKafkaCommand.java @@ -45,16 +45,12 @@ import picocli.CommandLine; /** * Class for command to stream Avro data into Kafka. */ -@CommandLine.Command(name = "StreamAvroIntoKafka") +@CommandLine.Command(name = "StreamAvroIntoKafka", mixinStandardHelpOptions = true) public class StreamAvroIntoKafkaCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(StreamAvroIntoKafkaCommand.class); @CommandLine.Option(names = {"-avroFile"}, required = true, description = "Avro file to stream.") private String _avroFile = null; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @CommandLine.Option(names = {"-kafkaBrokerList"}, required = false, description = "Kafka broker list.") private String _kafkaBrokerList = KafkaStarterUtils.DEFAULT_KAFKA_BROKER; @@ -72,11 +68,6 @@ public class StreamAvroIntoKafkaCommand extends AbstractBaseAdminCommand impleme description = "Delay in milliseconds between messages (default 1000 ms)") private String _millisBetweenMessages = "1000"; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "StreamAvroToKafka"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamGitHubEventsCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamGitHubEventsCommand.java index 06f06f8979..20db41c854 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamGitHubEventsCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StreamGitHubEventsCommand.java @@ -30,7 +30,7 @@ import picocli.CommandLine; /** * Command to stream GitHub events into a kafka topic or kinesis stream */ -@CommandLine.Command(name = "StreamGitHubEvents") +@CommandLine.Command(name = "StreamGitHubEvents", mixinStandardHelpOptions = true) public class StreamGitHubEventsCommand extends AbstractBaseAdminCommand implements Command { private static final String PULL_REQUEST_MERGED_EVENT_TYPE = "pullRequestMergedEvent"; @@ -89,9 +89,6 @@ public class StreamGitHubEventsCommand extends AbstractBaseAdminCommand implemen + "By default uses examples/stream/pullRequestMergedEvents/pullRequestMergedEvents_schema.json") private String _schemaFile; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, help = true, description = "Print this message.") - private boolean _help = false; - public void setPersonalAccessToken(String personalAccessToken) { _personalAccessToken = personalAccessToken; } @@ -112,11 +109,6 @@ public class StreamGitHubEventsCommand extends AbstractBaseAdminCommand implemen _schemaFile = schemaFile; } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "StreamGitHubEvents"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/UploadSegmentCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/UploadSegmentCommand.java index 3b0e41f700..3ca3fe87f9 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/UploadSegmentCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/UploadSegmentCommand.java @@ -43,7 +43,7 @@ import picocli.CommandLine; * * */ -@CommandLine.Command(name = "UploadSegment") +@CommandLine.Command(name = "UploadSegment", mixinStandardHelpOptions = true) public class UploadSegmentCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(UploadSegmentCommand.class); private static final String SEGMENT_UPLOADER = "segmentUploader"; @@ -79,17 +79,8 @@ public class UploadSegmentCommand extends AbstractBaseAdminCommand implements Co description = "Table type to upload. Can be OFFLINE or REALTIME") private TableType _tableType = TableType.OFFLINE; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - private AuthProvider _authProvider; - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "UploadSegment"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ValidateConfigCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ValidateConfigCommand.java index 3a2086d25b..7eedcdc3b5 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ValidateConfigCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ValidateConfigCommand.java @@ -47,7 +47,7 @@ import picocli.CommandLine; * <li>Schema</li> * </ul> */ -@CommandLine.Command(name = "ValidateConfig") +@CommandLine.Command(name = "ValidateConfig", mixinStandardHelpOptions = true) public class ValidateConfigCommand extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(ValidateConfigCommand.class); @@ -76,15 +76,6 @@ public class ValidateConfigCommand extends AbstractBaseCommand implements Comman description = "Space separated schema names to be validated (default to validate ALL)") private String _schemaNames; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help; - - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return "ValidateConfig"; diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifyClusterStateCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifyClusterStateCommand.java index 8246a09e75..bffbe18353 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifyClusterStateCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifyClusterStateCommand.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "VerifyClusterState") +@CommandLine.Command(name = "VerifyClusterState", mixinStandardHelpOptions = true) public class VerifyClusterStateCommand extends AbstractBaseAdminCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(VerifyClusterStateCommand.class); @@ -42,10 +42,6 @@ public class VerifyClusterStateCommand extends AbstractBaseAdminCommand implemen @CommandLine.Option(names = {"-timeoutSec"}, required = false, description = "Maximum timeout in second.") private long _timeoutSec = 300L; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @Override public String getName() { return "VerifyClusterState"; @@ -84,9 +80,4 @@ public class VerifyClusterStateCommand extends AbstractBaseAdminCommand implemen public String description() { return "Verify cluster's state after shutting down several nodes randomly."; } - - @Override - public boolean getHelp() { - return _help; - } } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifySegmentState.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifySegmentState.java index 9cd0579525..c39c198bc1 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifySegmentState.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/VerifySegmentState.java @@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command(name = "VerifySegmentState") +@CommandLine.Command(name = "VerifySegmentState", mixinStandardHelpOptions = true) public class VerifySegmentState extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(VerifySegmentState.class); @@ -47,14 +47,6 @@ public class VerifySegmentState extends AbstractBaseCommand implements Command { description = "Table name prefix. (Ex: myTable, my or myTable_OFFLINE)") String _tablePrefix = ""; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - - public boolean getHelp() { - return _help; - } - @Override public boolean execute() throws Exception { diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/filesystem/BaseFileOperation.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/filesystem/BaseFileOperation.java index dd5db83079..ddf77e89af 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/filesystem/BaseFileOperation.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/filesystem/BaseFileOperation.java @@ -50,9 +50,4 @@ public abstract class BaseFileOperation implements Command { PinotFSFactory.init(new PinotConfiguration(configs)); QuickstartRunner.registerDefaultPinotFS(); } - - @Override - public boolean getHelp() { - return _parent.getHelp(); - } } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/filesystem/PinotFSBenchmarkRunner.java b/pinot-tools/src/main/java/org/apache/pinot/tools/filesystem/PinotFSBenchmarkRunner.java index 8aef1278c8..ef000ee64a 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/filesystem/PinotFSBenchmarkRunner.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/filesystem/PinotFSBenchmarkRunner.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; import picocli.CommandLine; -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class PinotFSBenchmarkRunner extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(PinotFSBenchmarkRunner.class); @@ -57,10 +57,6 @@ public class PinotFSBenchmarkRunner extends AbstractBaseCommand implements Comma description = "The number of trials of operations when running a benchmark.") private Integer _numOps; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help = false; - @Override public boolean execute() throws Exception { @@ -80,9 +76,4 @@ public class PinotFSBenchmarkRunner extends AbstractBaseCommand implements Comma public String description() { return "Run Filesystem benchmark"; } - - @Override - public boolean getHelp() { - return _help; - } } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/perf/PerfBenchmarkRunner.java b/pinot-tools/src/main/java/org/apache/pinot/tools/perf/PerfBenchmarkRunner.java index 05a3b60379..f736cc9d96 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/perf/PerfBenchmarkRunner.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/perf/PerfBenchmarkRunner.java @@ -34,7 +34,7 @@ import picocli.CommandLine; @SuppressWarnings("FieldCanBeLocal") -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class PerfBenchmarkRunner extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(PerfBenchmarkRunner.class); @@ -92,15 +92,6 @@ public class PerfBenchmarkRunner extends AbstractBaseCommand implements Command @CommandLine.Option(names = {"-authTokenUrl"}, required = false, description = "Http auth token url.") private String _authTokenUrl; - @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() { return getClass().getSimpleName(); diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/perf/QueryRunner.java b/pinot-tools/src/main/java/org/apache/pinot/tools/perf/QueryRunner.java index a588d37097..39a660ea5e 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/perf/QueryRunner.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/perf/QueryRunner.java @@ -45,7 +45,7 @@ import picocli.CommandLine; @SuppressWarnings("FieldCanBeLocal") -@CommandLine.Command +@CommandLine.Command(mixinStandardHelpOptions = true) public class QueryRunner extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(QueryRunner.class); private static final int MILLIS_PER_SECOND = 1000; @@ -108,19 +108,11 @@ public class QueryRunner extends AbstractBaseCommand implements Command { private String _authToken; @CommandLine.Option(names = {"-authTokenUrl"}, required = false, description = "Http auth token url.") private String _authTokenUrl; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, description = "Print " - + "this message.") - private boolean _help; private enum QueryMode { FULL, RESAMPLE } - @Override - public boolean getHelp() { - return _help; - } - @Override public String getName() { return getClass().getSimpleName(); @@ -964,10 +956,6 @@ public class QueryRunner extends AbstractBaseCommand implements Command { QueryRunner queryRunner = new QueryRunner(); CommandLine commandLine = new CommandLine(queryRunner); commandLine.parseArgs(args); - if (queryRunner._help) { - queryRunner.printUsage(); - } else { - queryRunner.execute(); - } + queryRunner.execute(); } } diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentConvertCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentConvertCommand.java index 3476e56839..e9771ea4f4 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentConvertCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentConvertCommand.java @@ -41,7 +41,7 @@ import picocli.CommandLine; * </ul> */ @SuppressWarnings("FieldCanBeLocal") -@CommandLine.Command(name = "PinotSegmentConvert") +@CommandLine.Command(name = "PinotSegmentConvert", mixinStandardHelpOptions = true) public class PinotSegmentConvertCommand extends AbstractBaseCommand implements Command { private static final Logger LOGGER = LoggerFactory.getLogger(PinotSegmentConvertCommand.class); private static final String TEMP_DIR_NAME = "temp"; @@ -71,10 +71,6 @@ public class PinotSegmentConvertCommand extends AbstractBaseCommand implements C description = "Overwrite the existing file (default false).") private boolean _overwrite; - @CommandLine.Option(names = {"-help", "-h", "--h", "--help"}, required = false, help = true, - description = "Print this message.") - private boolean _help; - @Override public boolean execute() throws Exception { @@ -158,9 +154,4 @@ public class PinotSegmentConvertCommand extends AbstractBaseCommand implements C public String description() { return "Convert Pinot segments to another format such as AVRO/CSV/JSON."; } - - @Override - public boolean getHelp() { - return _help; - } } diff --git a/pinot-tools/src/test/java/org/apache/pinot/tools/admin/command/TestCommandHelp.java b/pinot-tools/src/test/java/org/apache/pinot/tools/admin/command/TestCommandHelp.java new file mode 100644 index 0000000000..d4d27df55e --- /dev/null +++ b/pinot-tools/src/test/java/org/apache/pinot/tools/admin/command/TestCommandHelp.java @@ -0,0 +1,51 @@ +/** + * 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.pinot.tools.admin.command; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.apache.pinot.tools.Command; +import org.apache.pinot.tools.admin.PinotAdministrator; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; + + +public class TestCommandHelp { + @DataProvider(name = "subCommands") + Object[][] subCommands() { + PinotAdministrator administrator = new PinotAdministrator(); + List<Object[]> inputs = new ArrayList<>(); + for (Map.Entry<String, Command> subCommand : administrator.getSubCommands().entrySet()) { + inputs.add(new Object[]{subCommand.getKey()}); + } + + return inputs.toArray(new Object[0][]); + } + + @Test(dataProvider = "subCommands") + void testHelp(String subCommand) { + PinotAdministrator administrator = new PinotAdministrator(); + String[] args = {subCommand, "--help"}; + administrator.execute(args); + assertEquals(administrator.getStatus(), 0); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org