This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch adding_version_option_in_pinot_admin in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit 23f7770ffc795b917c83efd3e36fcb369177bf01 Author: Xiang Fu <fx19880...@gmail.com> AuthorDate: Tue Dec 22 23:27:53 2020 -0800 Adding a version option to pinot admin to show all the component versions --- .../apache/pinot/tools/admin/PinotAdministrator.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 83c90da..d1fc6df 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 @@ -19,6 +19,8 @@ package org.apache.pinot.tools.admin; import java.lang.reflect.Field; +import java.util.Map; +import org.apache.pinot.common.Utils; import org.apache.pinot.spi.plugin.PluginManager; import org.apache.pinot.tools.Command; import org.apache.pinot.tools.admin.command.AddSchemaCommand; @@ -136,6 +138,9 @@ public class PinotAdministrator { @Option(name = "-help", required = false, help = true, aliases = {"-h", "--h", "--help"}, usage = "Print this message.") boolean _help = false; + + @Option(name = "-version", required = false, help = true, aliases = {"-v", "--v", "--version"}, usage = "Print the version of Pinot package.") + boolean _version = false; boolean _status = false; private boolean getStatus() { @@ -146,8 +151,9 @@ public class PinotAdministrator { try { CmdLineParser parser = new CmdLineParser(this); parser.parseArgument(args); - - if ((_subCommand == null) || _help) { + if (_version) { + printVersion(); + } else if ((_subCommand == null) || _help) { printUsage(); } else if (_subCommand.getHelp()) { _subCommand.printUsage(); @@ -162,6 +168,14 @@ public class PinotAdministrator { } } + private void printVersion() { + LOGGER.info("List All Pinot Component Versions:"); + Map<String, String> componentVersions = Utils.getComponentVersions(); + for (Map.Entry<String, String> entry : componentVersions.entrySet()) { + LOGGER.info("Package: {}, Version: {}", entry.getKey(), entry.getValue()); + } + } + public static void main(String[] args) { PluginManager.get().init(); PinotAdministrator pinotAdministrator = new PinotAdministrator(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org