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

Unified Diff: pkg/analyzer_experimental/bin/formatter.dart

Issue 23451046: Formatter stdin processing support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_experimental/bin/formatter.dart
===================================================================
--- pkg/analyzer_experimental/bin/formatter.dart (revision 27395)
+++ pkg/analyzer_experimental/bin/formatter.dart (working copy)
@@ -5,6 +5,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
+import 'dart:utf';
import 'package:args/args.dart';
import 'package:path/path.dart' as path;
@@ -75,11 +76,11 @@
_isDartFile(file) => dartFileRegExp.hasMatch(path.basename(file.path));
_formatStdin(options) {
- _log('not supported yet!');
-// stdin.transform(new StringDecoder())
-// .listen((String data) => print(data),
-// onError: (error) => print('Error reading from stdin'),
-// onDone: () => print('Finished reading data'));
+ var input = new StringBuffer();
+ stdin.transform(new Utf8DecoderTransformer())
+ .listen((String data) => input.write(data),
scheglov 2013/09/11 18:52:42 AFAIK code style (or at least Bob :-)) recommends
pquitslund 2013/09/11 19:02:38 Ah yes. And I was being inconsistent too (notice
+ onError: (error) => _log('Error reading from stdin'),
+ onDone: () => print(_formatCU(input.toString())));
}
/// Initialize the arg parser instance.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698