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

Unified Diff: packages/dart_style/bin/format.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 | « packages/dart_style/README.md ('k') | packages/dart_style/dist/dart-style.d.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/dart_style/bin/format.dart
diff --git a/packages/dart_style/bin/format.dart b/packages/dart_style/bin/format.dart
index 8d179c19a0537fdc34f5c8c1213c35de21513bde..e1eabbcbeea093d1e49d9b132fbc24a3ea3c23f9 100644
--- a/packages/dart_style/bin/format.dart
+++ b/packages/dart_style/bin/format.dart
@@ -14,7 +14,7 @@ import 'package:dart_style/src/io.dart';
import 'package:dart_style/src/source_code.dart';
// Note: The following line of code is modified by tool/grind.dart.
-const version = "0.2.1";
+const version = "0.2.16";
void main(List<String> args) {
var parser = new ArgParser(allowTrailingOptions: true);
@@ -33,6 +33,9 @@ void main(List<String> args) {
abbr: "n",
negatable: false,
help: "Show which files would be modified but make no changes.");
+ parser.addFlag("set-exit-if-changed",
+ negatable: false,
+ help: "Return exit code 1 if there are any formatting changes.");
parser.addFlag("overwrite",
abbr: "w",
negatable: false,
@@ -52,7 +55,7 @@ void main(List<String> args) {
negatable: false,
help: "Unused flag for compability with the old formatter.");
- var argResults;
+ ArgResults argResults;
try {
argResults = parser.parse(args);
} on FormatException catch (err) {
@@ -70,7 +73,7 @@ void main(List<String> args) {
}
// Can only preserve a selection when parsing from stdin.
- var selection;
+ List<int> selection;
if (argResults["preserve"] != null && argResults.rest.isNotEmpty) {
usageError(parser, "Can only use --preserve when reading from stdin.");
@@ -119,6 +122,10 @@ void main(List<String> args) {
reporter = new ProfileReporter(reporter);
}
+ if (argResults["set-exit-if-changed"]) {
+ reporter = new SetExitReporter(reporter);
+ }
+
var pageWidth;
try {
pageWidth = int.parse(argResults["line-length"]);
@@ -192,7 +199,7 @@ void formatStdin(FormatterOptions options, List<int> selection) {
var output = formatter.formatSource(source);
options.reporter
.afterFile(null, "<stdin>", output, changed: source != output);
- return true;
+ return;
} on FormatterException catch (err) {
stderr.writeln(err.message());
exitCode = 65; // sysexits.h: EX_DATAERR
« no previous file with comments | « packages/dart_style/README.md ('k') | packages/dart_style/dist/dart-style.d.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698