pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] sijie commented on a change in pull request #5738: [Pulsar Client Tools]Support generate documentation of pulsar admin cli automatically
Date Mon, 25 Nov 2019 19:53:24 GMT
sijie commented on a change in pull request #5738: [Pulsar Client Tools]Support generate documentation
of pulsar admin cli automatically
URL: https://github.com/apache/pulsar/pull/5738#discussion_r350389197
 
 

 ##########
 File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/PulsarAdminTool.java
 ##########
 @@ -166,13 +172,69 @@ boolean run(String[] args) {
         });
     }
 
+    void generateDocument(Function<PulsarAdminBuilder, ? extends PulsarAdmin> adminFactory,
String module) {
+        PulsarAdminTool tool;
+        try {
+            tool = new PulsarAdminTool(new Properties());
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+            System.err.println();
+            setupCommands(adminFactory);
+            jcommander.usage();
+            return;
+        }
+        StringBuilder sb = new StringBuilder();
+        tool.commandMap.get(module);
+        sb.append("------------\n\n");
+        sb.append("# " + module).append("\n\n");
+        sb.append("### Usage\n\n");
+        sb.append("`$" + module + "`\n\n");
+        sb.append("------------\n\n");
+        setupCommands(adminFactory);
 
 Review comment:
   when a user is generating documentation, he/she should *NOT* be required to create a Pulsar
admin. So we should provide a mock implementation of `adminFactory` to return a mock implementation
of PulsarAdmin. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message