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 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 | 8 |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 static _showUsage(parser) { | 147 static _showUsage(parser) { |
148 print('Usage: $_BINARY_NAME [options...] <libraries to analyze...>'); | 148 print('Usage: $_BINARY_NAME [options...] <libraries to analyze...>'); |
149 print(parser.getUsage()); | 149 print(parser.getUsage()); |
150 print(''); | 150 print(''); |
151 print('For more information, see http://www.dartlang.org/tools/analyzer.'); | 151 print('For more information, see http://www.dartlang.org/tools/analyzer.'); |
152 } | 152 } |
153 | 153 |
154 static String _getVersion() { | 154 static String _getVersion() { |
155 try { | 155 try { |
156 Path path = new Path(new Options().script); | 156 Path path = new Path(Platform.script); |
157 Path versionPath = path.directoryPath.append('..').append('version'); | 157 Path versionPath = path.directoryPath.append('..').append('version'); |
158 File versionFile = new File.fromPath(versionPath); | 158 File versionFile = new File.fromPath(versionPath); |
159 return versionFile.readAsStringSync().trim(); | 159 return versionFile.readAsStringSync().trim(); |
160 } catch (_) { | 160 } catch (_) { |
161 // This happens when the script is not running in the context of an SDK. | 161 // This happens when the script is not running in the context of an SDK. |
162 return "<unknown>"; | 162 return "<unknown>"; |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 _getNextFlagIndex(args, i) { | 257 _getNextFlagIndex(args, i) { |
258 for ( ; i < args.length; ++i) { | 258 for ( ; i < args.length; ++i) { |
259 if (args[i].startsWith('--')) { | 259 if (args[i].startsWith('--')) { |
260 return i; | 260 return i; |
261 } | 261 } |
262 } | 262 } |
263 return i; | 263 return i; |
264 } | 264 } |
265 } | 265 } |
OLD | NEW |