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 library analyzer_cli.src.options; | 5 library analyzer_cli.src.options; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
| 9 import 'package:analyzer_cli/src/driver.dart'; |
9 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
10 import 'package:cli_util/cli_util.dart' show getSdkDir; | 11 import 'package:cli_util/cli_util.dart' show getSdkDir; |
11 | 12 |
12 const _binaryName = 'dartanalyzer'; | 13 const _binaryName = 'dartanalyzer'; |
13 | 14 |
14 /// Shared exit handler. | 15 /// Shared exit handler. |
15 /// | 16 /// |
16 /// *Visible for testing.* | 17 /// *Visible for testing.* |
17 ExitHandler exitHandler = exit; | 18 ExitHandler exitHandler = exit; |
18 | 19 |
19 /// Print the given message to stderr and exit with the given [exitCode] | 20 /// Print the given message to stderr and exit with the given [exitCode] |
20 void printAndFail(String message, {int exitCode: 15}) { | 21 void printAndFail(String message, {int exitCode: 15}) { |
21 stderr.writeln(message); | 22 errorSink.writeln(message); |
22 exitHandler(exitCode); | 23 exitHandler(exitCode); |
23 } | 24 } |
24 | 25 |
25 /// Exit handler. | 26 /// Exit handler. |
26 /// | 27 /// |
27 /// *Visible for testing.* | 28 /// *Visible for testing.* |
28 typedef void ExitHandler(int code); | 29 typedef void ExitHandler(int code); |
29 | 30 |
30 /// Analyzer commandline configuration options. | 31 /// Analyzer commandline configuration options. |
31 class CommandLineOptions { | 32 class CommandLineOptions { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 485 |
485 int _getNextFlagIndex(args, i) { | 486 int _getNextFlagIndex(args, i) { |
486 for (; i < args.length; ++i) { | 487 for (; i < args.length; ++i) { |
487 if (args[i].startsWith('--')) { | 488 if (args[i].startsWith('--')) { |
488 return i; | 489 return i; |
489 } | 490 } |
490 } | 491 } |
491 return i; | 492 return i; |
492 } | 493 } |
493 } | 494 } |
OLD | NEW |