Chromium Code Reviews| Index: lib/src/usage.dart |
| diff --git a/lib/src/usage.dart b/lib/src/usage.dart |
| index 11be54b38983900ea14ddf0c9223bcb20b2a6923..162dcbde634ac50f4dddc293c61b5cad633627e5 100644 |
| --- a/lib/src/usage.dart |
| +++ b/lib/src/usage.dart |
| @@ -62,8 +62,17 @@ class Usage { |
| calculateColumnWidths(); |
| - args.options.forEach((name, option) { |
| - if (option.hide) return; |
| + for (var optionOrSeparator in args.optionsAndSeparators) { |
| + if (optionOrSeparator is String) { |
| + // Ensure that there's always a blank line before a separator. |
| + if (buffer.isNotEmpty) buffer.write("\n\n"); |
| + buffer.write(optionOrSeparator); |
| + newlinesNeeded = 1; |
| + continue; |
| + } |
| + |
| + var option = optionOrSeparator; |
|
Bob Nystrom
2015/05/21 16:43:16
Do you need an "as Option" here?
nweiz
2015/05/21 19:22:27
The analyzer infers it as dynamic, so it doesn't p
Bob Nystrom
2015/05/21 19:42:27
Yeah, I think so.
nweiz
2015/05/21 19:52:37
Done.
|
| + if (option.hide) continue; |
| write(0, getAbbreviation(option)); |
| write(1, getLongOption(option)); |
| @@ -94,7 +103,7 @@ class Usage { |
| // blank line after it. This gives space where it's useful while still |
| // keeping simple one-line options clumped together. |
| if (numHelpLines > 1) newline(); |
| - }); |
| + } |
| return buffer.toString(); |
| } |