Skip to content

Commit

Permalink
Fix printing of options categories in CLI help
Browse files Browse the repository at this point in the history
Before it was omitting category titles / section breaks if the first option of the new category happened to be undocumented.

RELNOTES: None
PiperOrigin-RevId: 155458981
  • Loading branch information
brandjon authored and kchodorow committed May 9, 2017
1 parent 4e0a5cb commit ea71d6d
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,14 @@ public String describeOptions(
for (Field optionField : allFields) {
Option option = optionField.getAnnotation(Option.class);
String category = option.category();
if (!category.equals(prevCategory)) {
prevCategory = category;
if (!category.equals(prevCategory)
&& option.optionUsageRestrictions() == OptionUsageRestrictions.DOCUMENTED) {
String description = categoryDescriptions.get(category);
if (description == null) {
description = "Options category '" + category + "'";
}
if (option.optionUsageRestrictions() == OptionUsageRestrictions.DOCUMENTED) {
desc.append("\n").append(description).append(":\n");
}
desc.append("\n").append(description).append(":\n");
prevCategory = category;
}

if (option.optionUsageRestrictions() == OptionUsageRestrictions.DOCUMENTED) {
Expand Down

0 comments on commit ea71d6d

Please sign in to comment.