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:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 | 10 |
11 import '../lib/src/command.dart'; | 11 import '../lib/src/command.dart'; |
12 import '../lib/src/exit_codes.dart' as exit_codes; | 12 import '../lib/src/exit_codes.dart' as exit_codes; |
13 import '../lib/src/io.dart'; | 13 import '../lib/src/io.dart'; |
14 import '../lib/src/log.dart' as log; | 14 import '../lib/src/log.dart' as log; |
15 import '../lib/src/sdk.dart' as sdk; | 15 import '../lib/src/sdk.dart' as sdk; |
16 import '../lib/src/utils.dart'; | 16 import '../lib/src/utils.dart'; |
17 | 17 |
18 void main(List<String> arguments) { | 18 void main(List<String> arguments) { |
19 ArgResults options; | 19 ArgResults options; |
20 | 20 |
21 try { | 21 try { |
22 options = PubCommand.pubArgParser.parse(arguments); | 22 options = PubCommand.pubArgParser.parse(arguments, |
| 23 allowTrailingOptions: true); |
23 } on FormatException catch (e) { | 24 } on FormatException catch (e) { |
24 log.error(e.message); | 25 log.error(e.message); |
25 log.error('Run "pub help" to see available options.'); | 26 log.error('Run "pub help" to see available options.'); |
26 flushThenExit(exit_codes.USAGE); | 27 flushThenExit(exit_codes.USAGE); |
27 return; | 28 return; |
28 } | 29 } |
29 | 30 |
30 if (options['version']) { | 31 if (options['version']) { |
31 log.message('Pub ${sdk.version}'); | 32 log.message('Pub ${sdk.version}'); |
32 return; | 33 return; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (Platform.operatingSystem != 'windows') return null; | 93 if (Platform.operatingSystem != 'windows') return null; |
93 | 94 |
94 return runProcess('ver', []).then((result) { | 95 return runProcess('ver', []).then((result) { |
95 if (result.stdout.join('\n').contains('XP')) { | 96 if (result.stdout.join('\n').contains('XP')) { |
96 log.error('Sorry, but pub is not supported on Windows XP.'); | 97 log.error('Sorry, but pub is not supported on Windows XP.'); |
97 return flushThenExit(exit_codes.USAGE); | 98 return flushThenExit(exit_codes.USAGE); |
98 } | 99 } |
99 }); | 100 }); |
100 }); | 101 }); |
101 } | 102 } |
OLD | NEW |