| 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:analyzer_cli/src/driver.dart'; |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 'No source files expected in the persistent worker mode.'); | 501 'No source files expected in the persistent worker mode.'); |
| 502 _showUsage(parser); | 502 _showUsage(parser); |
| 503 exitHandler(15); | 503 exitHandler(15); |
| 504 return null; // Only reachable in testing. | 504 return null; // Only reachable in testing. |
| 505 } | 505 } |
| 506 } else if (results['version']) { | 506 } else if (results['version']) { |
| 507 outSink.write('$_binaryName version ${_getVersion()}'); | 507 outSink.write('$_binaryName version ${_getVersion()}'); |
| 508 exitHandler(0); | 508 exitHandler(0); |
| 509 return null; // Only reachable in testing. | 509 return null; // Only reachable in testing. |
| 510 } else { | 510 } else { |
| 511 if (results.rest.isEmpty) { | 511 if (results.rest.isEmpty && !results['build-mode']) { |
| 512 _showUsage(parser); | 512 _showUsage(parser); |
| 513 exitHandler(15); | 513 exitHandler(15); |
| 514 return null; // Only reachable in testing. | 514 return null; // Only reachable in testing. |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 return new CommandLineOptions._fromArgs(results, definedVariables); | 517 return new CommandLineOptions._fromArgs(results, definedVariables); |
| 518 } on FormatException catch (e) { | 518 } on FormatException catch (e) { |
| 519 errorSink.writeln(e.message); | 519 errorSink.writeln(e.message); |
| 520 _showUsage(parser); | 520 _showUsage(parser); |
| 521 exitHandler(15); | 521 exitHandler(15); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 | 667 |
| 668 int _getNextFlagIndex(args, i) { | 668 int _getNextFlagIndex(args, i) { |
| 669 for (; i < args.length; ++i) { | 669 for (; i < args.length; ++i) { |
| 670 if (args[i].startsWith('--')) { | 670 if (args[i].startsWith('--')) { |
| 671 return i; | 671 return i; |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 return i; | 674 return i; |
| 675 } | 675 } |
| 676 } | 676 } |
| OLD | NEW |