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

Side by Side Diff: lib/src/io.dart

Issue 945583004: If no paths are provided, read source from stdin. Fix #165. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « example/format.dart ('k') | test/command_line_test.dart » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart_style.src.io; 5 library dart_style.src.io;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 var formatter = new DartFormatter(pageWidth: options.pageWidth); 54 var formatter = new DartFormatter(pageWidth: options.pageWidth);
55 try { 55 try {
56 var source = file.readAsStringSync(); 56 var source = file.readAsStringSync();
57 var output = formatter.format(source, uri: file.path); 57 var output = formatter.format(source, uri: file.path);
58 options.reporter.showFile(file, label, output, changed: source != output); 58 options.reporter.showFile(file, label, output, changed: source != output);
59 return true; 59 return true;
60 } on FormatterException catch (err) { 60 } on FormatterException catch (err) {
61 stderr.writeln(err.message()); 61 stderr.writeln(err.message());
62 } catch (err, stack) { 62 } catch (err, stack) {
63 stderr.writeln('''Hit a bug in the formatter when formatting $label 63 stderr.writeln('''Hit a bug in the formatter when formatting $label.
64 Please report at: github.com/dart-lang/dart_style/issues 64 Please report at: github.com/dart-lang/dart_style/issues
65 $err 65 $err
66 $stack'''); 66 $stack''');
67 } 67 }
68 68
69 return false; 69 return false;
70 } 70 }
OLDNEW
« no previous file with comments | « example/format.dart ('k') | test/command_line_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698