| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 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:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| 11 import 'package:stack_trace/stack_trace.dart'; | 11 import 'package:stack_trace/stack_trace.dart'; |
| 12 | 12 |
| 13 import '../lib/src/command.dart'; | 13 import '../lib/src/command.dart'; |
| 14 import '../lib/src/exit_codes.dart' as exit_codes; | 14 import '../lib/src/exit_codes.dart' as exit_codes; |
| 15 import '../lib/src/http.dart'; | 15 import '../lib/src/http.dart'; |
| 16 import '../lib/src/io.dart'; | 16 import '../lib/src/io.dart'; |
| 17 import '../lib/src/log.dart' as log; | 17 import '../lib/src/log.dart' as log; |
| 18 import '../lib/src/sdk.dart' as sdk; | 18 import '../lib/src/sdk.dart' as sdk; |
| 19 import '../lib/src/utils.dart'; | 19 import '../lib/src/utils.dart'; |
| 20 | 20 |
| 21 void main(List<String> arguments) { | 21 void main(List<String> arguments) { |
| 22 ArgResults options; | 22 ArgResults options; |
| 23 | 23 |
| 24 try { | 24 try { |
| 25 options = PubCommand.pubArgParser.parse(arguments, | 25 options = PubCommand.pubArgParser.parse(arguments); |
| 26 allowTrailingOptions: true); | |
| 27 } on FormatException catch (e) { | 26 } on FormatException catch (e) { |
| 28 log.error(e.message); | 27 log.error(e.message); |
| 29 log.error('Run "pub help" to see available options.'); | 28 log.error('Run "pub help" to see available options.'); |
| 30 flushThenExit(exit_codes.USAGE); | 29 flushThenExit(exit_codes.USAGE); |
| 31 return; | 30 return; |
| 32 } | 31 } |
| 33 | 32 |
| 34 if (options['version']) { | 33 if (options['version']) { |
| 35 log.message('Pub ${sdk.version}'); | 34 log.message('Pub ${sdk.version}'); |
| 36 return; | 35 return; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (Platform.operatingSystem != 'windows') return null; | 208 if (Platform.operatingSystem != 'windows') return null; |
| 210 | 209 |
| 211 return runProcess('ver', []).then((result) { | 210 return runProcess('ver', []).then((result) { |
| 212 if (result.stdout.join('\n').contains('XP')) { | 211 if (result.stdout.join('\n').contains('XP')) { |
| 213 log.error('Sorry, but pub is not supported on Windows XP.'); | 212 log.error('Sorry, but pub is not supported on Windows XP.'); |
| 214 return flushThenExit(exit_codes.USAGE); | 213 return flushThenExit(exit_codes.USAGE); |
| 215 } | 214 } |
| 216 }); | 215 }); |
| 217 }); | 216 }); |
| 218 } | 217 } |
| OLD | NEW |