Skip to content

Commit

Permalink
fix: pulsar-client and pulsar-perf cli doc command flag duplicated (a…
Browse files Browse the repository at this point in the history
…pache#11182)

### Master Issue: apache#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
  • Loading branch information
urfreespace authored Jul 7, 2021
1 parent 1b943bb commit 4cbae56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,12 @@ protected String generateDocument(String module, JCommander parentCmd) {
}
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,12 @@ private static String generateDocument(String module, JCommander parentCmd) {
}
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();
}
Expand Down

0 comments on commit 4cbae56

Please sign in to comment.