You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/11/05 08:17:45 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #12535: [pulsar-admin] Add --all option to get all version schema of topic

eolivelli commented on a change in pull request #12535:
URL: https://github.com/apache/pulsar/pull/12535#discussion_r743459137



##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSchemas.java
##########
@@ -51,13 +52,24 @@ public CmdSchemas(Supplier<PulsarAdmin> admin) {
         @Parameter(names = { "--version" }, description = "version", required = false)
         private Long version;
 
+        @Parameter(names = {"--all"}, description = "all version", required = false)
+        private boolean all = false;
+
         @Override
         void run() throws Exception {
             String topic = validateTopicName(params);
-            if (version == null) {
+            if (version != null && all) {
+                throw new ParameterException("Only one or neither of --version and --all can be specified.");
+            }
+            if (version == null && !all) {
                 System.out.println(getAdmin().schemas().getSchemaInfoWithVersion(topic));
-            } else {
+            } else if (!all) {
+                if (version < 0) {
+                    throw new ParameterException("Option --version must be greater than 0, but found " + version);
+                }
                 System.out.println(getAdmin().schemas().getSchemaInfo(topic, version));
+            } else {
+                System.out.println(getAdmin().schemas().getAllSchemas(topic));

Review comment:
       is there a better way to format this output ?




-- 
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@pulsar.apache.org

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