OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:convert'; | 5 import 'dart:convert'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:args/args.dart'; | 8 import 'package:args/args.dart'; |
9 import 'package:dart_style/src/dart_formatter.dart'; | 9 import 'package:dart_style/src/dart_formatter.dart'; |
10 import 'package:dart_style/src/formatter_exception.dart'; | 10 import 'package:dart_style/src/formatter_exception.dart'; |
(...skipping 18 matching lines...) Expand all Loading... |
29 abbr: "w", | 29 abbr: "w", |
30 negatable: false, | 30 negatable: false, |
31 help: "Overwrite input files with formatted output."); | 31 help: "Overwrite input files with formatted output."); |
32 parser.addFlag("machine", | 32 parser.addFlag("machine", |
33 abbr: "m", | 33 abbr: "m", |
34 negatable: false, | 34 negatable: false, |
35 help: "Produce machine-readable JSON output."); | 35 help: "Produce machine-readable JSON output."); |
36 parser.addFlag("follow-links", | 36 parser.addFlag("follow-links", |
37 negatable: false, | 37 negatable: false, |
38 help: "Follow links to files and directories.\n" | 38 help: "Follow links to files and directories.\n" |
39 "If unset, links will be ignored."); | 39 "If unset, links will be ignored."); |
40 parser.addFlag("transform", | 40 parser.addFlag("transform", |
41 abbr: "t", | 41 abbr: "t", |
42 negatable: false, | 42 negatable: false, |
43 help: "Unused flag for compability with the old formatter."); | 43 help: "Unused flag for compability with the old formatter."); |
44 | 44 |
45 var argResults; | 45 var argResults; |
46 try { | 46 try { |
47 argResults = parser.parse(args); | 47 argResults = parser.parse(args); |
48 } on FormatException catch (err) { | 48 } on FormatException catch (err) { |
49 usageError(parser, err.message); | 49 usageError(parser, err.message); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 output = stdout; | 207 output = stdout; |
208 } | 208 } |
209 | 209 |
210 output.write("""$message | 210 output.write("""$message |
211 | 211 |
212 Usage: dartfmt [-n|-w] [files or directories...] | 212 Usage: dartfmt [-n|-w] [files or directories...] |
213 | 213 |
214 ${parser.usage} | 214 ${parser.usage} |
215 """); | 215 """); |
216 } | 216 } |
OLD | NEW |