Index: lib/src/io.dart |
diff --git a/lib/src/io.dart b/lib/src/io.dart |
index 579ed1b2db25286d7d042c1034dfc2ee1671ea7d..e1910332a83d7354ec8cceceac4ce814491fd592 100644 |
--- a/lib/src/io.dart |
+++ b/lib/src/io.dart |
@@ -38,10 +38,15 @@ void processFile(File file, {String label, bool overwrite, int pageWidth}) { |
var formatter = new DartFormatter(pageWidth: pageWidth); |
try { |
- var output = formatter.format(file.readAsStringSync(), uri: file.path); |
+ var source = file.readAsStringSync(); |
+ var output = formatter.format(source, uri: file.path); |
if (overwrite) { |
- file.writeAsStringSync(output); |
- print("Formatted $label"); |
+ if (source != output) { |
+ file.writeAsStringSync(output); |
+ print("Formatted $label"); |
+ } else { |
+ print("Unchanged $label"); |
+ } |
} else { |
// Don't add an extra newline. |
stdout.write(output); |