Chromium Code Reviews| Index: pkg/analyzer_experimental/bin/formatter.dart |
| =================================================================== |
| --- pkg/analyzer_experimental/bin/formatter.dart (revision 26807) |
| +++ pkg/analyzer_experimental/bin/formatter.dart (working copy) |
| @@ -7,12 +7,13 @@ |
| import 'dart:io'; |
| import 'package:args/args.dart'; |
| +import 'package:path/path.dart' as path; |
|
Bob Nystrom
2013/08/28 18:18:55
Don't forget to add path to your pubspec.yaml too
pquitslund
2013/08/28 20:29:13
Already there! :)
|
| import 'package:analyzer_experimental/src/services/formatter_impl.dart'; |
| const BINARY_NAME = 'dartfmt'; |
| -const DART_EXT = '.dart'; |
| +final DART_FILE_REGEXP = new RegExp(r'^[^.].*\.dart$', caseSensitive: false); |
|
Bob Nystrom
2013/08/28 18:18:55
Should be "dartFileRegExp" now since it isn't cons
pquitslund
2013/08/28 20:29:13
Done.
|
| final argParser = _initArgParser(); |
| void main() { |
| @@ -51,8 +52,6 @@ |
| void _formatFile(file) { |
| - Uri.parse(file).pathSegments.last; |
| - print(file.path); |
| if (_isDartFile(file)) { |
| try { |
| var buffer = new StringBuffer(); |
| @@ -66,8 +65,7 @@ |
| } |
| } |
| -//TODO(pquitslund): fix this using 'path' |
| -_isDartFile(file) => !file.path.startsWith('.') && file.path.endsWith(DART_EXT); |
| +_isDartFile(file) => DART_FILE_REGEXP.hasMatch(path.basename(file.path)); |
| _formatStdin(options) { |
| _log('not supported yet!'); |