nodece commented on code in PR #22303:
URL: https://github.com/apache/pulsar/pull/22303#discussion_r1531508942
##########
pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java:
##########
@@ -80,36 +81,36 @@ public static void main(String[] args) throws Exception {
Class<?> clazz = entry.getValue();
Constructor<?> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
- jc.addCommand(cmd, constructor.newInstance());
+ commander.addSubcommand(cmd, constructor.newInstance());
}
if (arguments.commandNames.size() == 0) {
- for (Map.Entry<String, JCommander> cmd :
jc.getCommands().entrySet()) {
- generateDocument(cmd.getKey(), jc);
+ for (Map.Entry<String, CommandLine> cmd :
commander.getSubcommands().entrySet()) {
+ generateDocument(cmd.getKey(), commander);
}
} else {
for (String commandName : arguments.commandNames) {
- generateDocument(commandName, jc);
+ generateDocument(commandName, commander);
}
}
}
- private static String generateDocument(String module, JCommander
parentCmd) {
+ private static String generateDocument(String module, CommandLine
parentCmd) {
StringBuilder sb = new StringBuilder();
- JCommander cmd = parentCmd.getCommands().get(module);
+ CommandLine cmd = parentCmd.getSubcommands().get(module);
sb.append("## ").append(module).append("\n\n");
-
sb.append(parentCmd.getUsageFormatter().getCommandDescription(module)).append("\n");
+ sb.append(cmd.getCommandName()).append("\n");
Review Comment:
public static String getCommandDescription(CommandLine commandLine) {
String[] description =
commandLine.getCommandSpec().usageMessage().description();
if (description != null && description.length != 0) {
return description[0];
}
return "";
}
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]