| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 options; | 5 library options; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 static _showUsage(parser) { | 185 static _showUsage(parser) { |
| 186 print('Usage: $_BINARY_NAME [options...] <libraries to analyze...>'); | 186 print('Usage: $_BINARY_NAME [options...] <libraries to analyze...>'); |
| 187 print(parser.getUsage()); | 187 print(parser.getUsage()); |
| 188 print(''); | 188 print(''); |
| 189 print('For more information, see http://www.dartlang.org/tools/analyzer.'); | 189 print('For more information, see http://www.dartlang.org/tools/analyzer.'); |
| 190 } | 190 } |
| 191 | 191 |
| 192 static String _getVersion() { | 192 static String _getVersion() { |
| 193 try { | 193 try { |
| 194 String versionPath = Platform.script.resolve('../version').toFilePath(); | 194 // This is relative to bin/snapshot, so ../.. |
| 195 String versionPath = |
| 196 Platform.script.resolve('../../version').toFilePath(); |
| 195 File versionFile = new File(versionPath); | 197 File versionFile = new File(versionPath); |
| 196 return versionFile.readAsStringSync().trim(); | 198 return versionFile.readAsStringSync().trim(); |
| 197 } catch (_) { | 199 } catch (_) { |
| 198 // This happens when the script is not running in the context of an SDK. | 200 // This happens when the script is not running in the context of an SDK. |
| 199 return "<unknown>"; | 201 return "<unknown>"; |
| 200 } | 202 } |
| 201 } | 203 } |
| 202 } | 204 } |
| 203 | 205 |
| 204 /** | 206 /** |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 314 |
| 313 _getNextFlagIndex(args, i) { | 315 _getNextFlagIndex(args, i) { |
| 314 for ( ; i < args.length; ++i) { | 316 for ( ; i < args.length; ++i) { |
| 315 if (args[i].startsWith('--')) { | 317 if (args[i].startsWith('--')) { |
| 316 return i; | 318 return i; |
| 317 } | 319 } |
| 318 } | 320 } |
| 319 return i; | 321 return i; |
| 320 } | 322 } |
| 321 } | 323 } |
| OLD | NEW |