Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: pkg/args/lib/src/usage.dart

Issue 203273013: Ignore hidden options when calculating usage columns. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/args/CHANGELOG.md ('k') | pkg/args/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library args.src.usage; 5 library args.src.usage;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import '../args.dart'; 9 import '../args.dart';
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 String getAllowedTitle(String allowed) { 122 String getAllowedTitle(String allowed) {
123 return ' [$allowed]'; 123 return ' [$allowed]';
124 } 124 }
125 125
126 void calculateColumnWidths() { 126 void calculateColumnWidths() {
127 int abbr = 0; 127 int abbr = 0;
128 int title = 0; 128 int title = 0;
129 args.options.forEach((name, option) { 129 args.options.forEach((name, option) {
130 if (option.hide) return;
131
130 // Make room in the first column if there are abbreviations. 132 // Make room in the first column if there are abbreviations.
131 abbr = max(abbr, getAbbreviation(option).length); 133 abbr = max(abbr, getAbbreviation(option).length);
132 134
133 // Make room for the option. 135 // Make room for the option.
134 title = max(title, getLongOption(option).length); 136 title = max(title, getLongOption(option).length);
135 137
136 // Make room for the allowed help. 138 // Make room for the allowed help.
137 if (option.allowedHelp != null) { 139 if (option.allowedHelp != null) {
138 for (var allowed in option.allowedHelp.keys) { 140 for (var allowed in option.allowedHelp.keys) {
139 title = max(title, getAllowedTitle(allowed).length); 141 title = max(title, getAllowedTitle(allowed).length);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 String padRight(String source, int length) { 233 String padRight(String source, int length) {
232 final result = new StringBuffer(); 234 final result = new StringBuffer();
233 result.write(source); 235 result.write(source);
234 236
235 while (result.length < length) { 237 while (result.length < length) {
236 result.write(' '); 238 result.write(' ');
237 } 239 }
238 240
239 return result.toString(); 241 return result.toString();
240 } 242 }
OLDNEW
« no previous file with comments | « pkg/args/CHANGELOG.md ('k') | pkg/args/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698