| Index: pkg/analyzer/bin/formatter.dart
|
| ===================================================================
|
| --- pkg/analyzer/bin/formatter.dart (revision 32027)
|
| +++ pkg/analyzer/bin/formatter.dart (working copy)
|
| @@ -63,7 +63,7 @@
|
| selection = _parseSelection(options[SELECTION_FLAG]);
|
| formatterSettings =
|
| new FormatterOptions(codeTransforms: options[TRANSFORM_FLAG],
|
| - pageWidth: _toInt(options[MAX_LINE_FLAG]));
|
| + pageWidth: _parseLineLength(options[MAX_LINE_FLAG]));
|
| }
|
|
|
| CodeKind _parseKind(kindOption) {
|
| @@ -75,6 +75,21 @@
|
| }
|
| }
|
|
|
| +int _parseLineLength(String lengthOption) {
|
| + var length = _toInt(lengthOption);
|
| + if (length == null) {
|
| + var val = lengthOption.toUpperCase();
|
| + if (val == 'INF' || val == 'INFINITY') {
|
| + length = -1;
|
| + } else {
|
| + throw new FormatterException('Line length is specified as an Integer or '
|
| + 'the value "Inf".');
|
| + }
|
| + }
|
| + return length;
|
| +}
|
| +
|
| +
|
| Selection _parseSelection(selectionOption) {
|
| if (selectionOption != null) {
|
| var units = selectionOption.split(',');
|
| @@ -159,10 +174,11 @@
|
| parser.addFlag(TRANSFORM_FLAG, abbr: 't', negatable: false,
|
| help: 'Perform code transformations.');
|
| parser.addOption(MAX_LINE_FLAG, abbr: 'l', defaultsTo: '80',
|
| - help: 'Wrap lines longer than this length.');
|
| + help: 'Wrap lines longer than this length. '
|
| + 'To never wrap, specify "Infinity" or "Inf" for short.');
|
| parser.addOption(KIND_FLAG, abbr: 'k', defaultsTo: 'cu',
|
| - help: 'Specify source snippet kind ("stmt" or "cu")'
|
| - ' --- [PROVISIONAL API].', hide: true);
|
| + help: 'Specify source snippet kind ("stmt" or "cu") '
|
| + '--- [PROVISIONAL API].', hide: true);
|
| parser.addOption(SELECTION_FLAG, abbr: 's',
|
| help: 'Specify selection information as an offset,length pair '
|
| '(e.g., -s "0,4").', hide: true);
|
|
|