This is an automated email from the ASF dual-hosted git repository. guangning pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push: new 4cbae56 fix: pulsar-client and pulsar-perf cli doc command flag duplicated (#11182) 4cbae56 is described below commit 4cbae56523f903bd8f38c1ec4fb4f9d1580fb53b Author: Li Li <urfreesp...@gmail.com> AuthorDate: Wed Jul 7 11:37:47 2021 +0800 fix: pulsar-client and pulsar-perf cli doc command flag duplicated (#11182) ### Master Issue: #10040 ### Motivation Support auto generate HTML page for pulsar client cli tool, for example: https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin ### Modifications fix duplicated long and short command line parameter names for pulsar-client cli docs fix duplicated long and short command line parameter names for pulsar-perf cli docs --- .../pulsar/client/cli/CmdGenerateDocumentation.java | 17 ++++++----------- .../pulsar/testclient/CmdGenerateDocumentation.java | 17 ++++++----------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java index 9a7a80a..c9e44f3 100644 --- a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java +++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java @@ -79,17 +79,12 @@ public class CmdGenerateDocumentation { } sb.append("|Flag|Description|Default|\n"); sb.append("|---|---|---|\n"); - // IKey is an internal interface and cannot be accessed directly, - // so the type needs to be erased and force cast to a subclass - Map descriptionMap = cmd.getDescriptions(); - descriptionMap.forEach((k, v) -> { - StringKey key = (StringKey) k; - ParameterDescription description = (ParameterDescription) v; - sb.append("| `").append(key.getName()) - .append("` | ").append(description.getDescription().replace("\n", " ")) - .append("|").append(description.getDefault()).append("|\n"); - - }); + List<ParameterDescription> options = cmd.getParameters(); + options.forEach((option) -> + sb.append("| `").append(option.getNames()) + .append("` | ").append(option.getDescription().replace("\n", " ")) + .append("|").append(option.getDefault()).append("|\n") + ); System.out.println(sb.toString()); return sb.toString(); } diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java index 03a1029..40b02cf 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java @@ -109,17 +109,12 @@ public class CmdGenerateDocumentation { } sb.append("|Flag|Description|Default|\n"); sb.append("|---|---|---|\n"); - // IKey is an internal interface and cannot be accessed directly, - // so the type needs to be erased and force cast to a subclass - Map descriptionMap = cmd.getDescriptions(); - descriptionMap.forEach((k, v) -> { - StringKey key = (StringKey) k; - ParameterDescription description = (ParameterDescription) v; - sb.append("| `").append(key.getName()) - .append("` | ").append(description.getDescription().replace("\n", " ")) - .append("|").append(description.getDefault()).append("|\n"); - - }); + List<ParameterDescription> options = cmd.getParameters(); + options.forEach((option) -> + sb.append("| `").append(option.getNames()) + .append("` | ").append(option.getDescription().replace("\n", " ")) + .append("|").append(option.getDefault()).append("|\n") + ); System.out.println(sb.toString()); return sb.toString(); }