| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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:args/command_runner.dart'; | 9 import 'package:args/command_runner.dart'; |
| 10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 'warning': 'Show only errors and warnings.', | 51 'warning': 'Show only errors and warnings.', |
| 52 'normal': 'Show errors, warnings, and user messages.', | 52 'normal': 'Show errors, warnings, and user messages.', |
| 53 'io': 'Also show IO operations.', | 53 'io': 'Also show IO operations.', |
| 54 'solver': 'Show steps during version resolution.', | 54 'solver': 'Show steps during version resolution.', |
| 55 'all': 'Show all output including internal tracing messages.' | 55 'all': 'Show all output including internal tracing messages.' |
| 56 }); | 56 }); |
| 57 argParser.addFlag('verbose', abbr: 'v', negatable: false, | 57 argParser.addFlag('verbose', abbr: 'v', negatable: false, |
| 58 help: 'Shortcut for "--verbosity=all".'); | 58 help: 'Shortcut for "--verbosity=all".'); |
| 59 argParser.addFlag('with-prejudice', hide: !isAprilFools, | 59 argParser.addFlag('with-prejudice', hide: !isAprilFools, |
| 60 negatable: false, help: 'Execute commands with prejudice.'); | 60 negatable: false, help: 'Execute commands with prejudice.'); |
| 61 argParser.addFlag('sparkle', hide: !isAprilFools, |
| 62 negatable: false, help: 'A more sparkly experience.'); |
| 61 argParser.addFlag('package-symlinks', | 63 argParser.addFlag('package-symlinks', |
| 62 negatable: true, defaultsTo: true, hide: true, | 64 negatable: true, defaultsTo: true, hide: true, |
| 63 help: "Generate packages/ directories when installing packages."); | 65 help: "Generate packages/ directories when installing packages."); |
| 64 | 66 |
| 65 addCommand(new BuildCommand()); | 67 addCommand(new BuildCommand()); |
| 66 addCommand(new CacheCommand()); | 68 addCommand(new CacheCommand()); |
| 67 addCommand(new DepsCommand()); | 69 addCommand(new DepsCommand()); |
| 68 addCommand(new DowngradeCommand()); | 70 addCommand(new DowngradeCommand()); |
| 69 addCommand(new GlobalCommand()); | 71 addCommand(new GlobalCommand()); |
| 70 addCommand(new GetCommand()); | 72 addCommand(new GetCommand()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 options = super.parse(arguments); | 85 options = super.parse(arguments); |
| 84 } on UsageException catch (error) { | 86 } on UsageException catch (error) { |
| 85 log.error(error.message); | 87 log.error(error.message); |
| 86 await flushThenExit(exit_codes.USAGE); | 88 await flushThenExit(exit_codes.USAGE); |
| 87 } | 89 } |
| 88 await runCommand(options); | 90 await runCommand(options); |
| 89 } | 91 } |
| 90 | 92 |
| 91 Future runCommand(ArgResults options) async { | 93 Future runCommand(ArgResults options) async { |
| 92 log.withPrejudice = options['with-prejudice']; | 94 log.withPrejudice = options['with-prejudice']; |
| 95 log.sparkle = options['sparkle']; |
| 93 | 96 |
| 94 _checkDepsSynced(); | 97 _checkDepsSynced(); |
| 95 | 98 |
| 96 if (options['version']) { | 99 if (options['version']) { |
| 97 log.message('Pub ${sdk.version}'); | 100 log.message('Pub ${sdk.version}'); |
| 98 return; | 101 return; |
| 99 } | 102 } |
| 100 | 103 |
| 101 if (options['trace']) { | 104 if (options['trace']) { |
| 102 log.recordTranscript(); | 105 log.recordTranscript(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 Future _validatePlatform() async { | 216 Future _validatePlatform() async { |
| 214 if (Platform.operatingSystem != 'windows') return; | 217 if (Platform.operatingSystem != 'windows') return; |
| 215 | 218 |
| 216 var result = await runProcess('ver', []); | 219 var result = await runProcess('ver', []); |
| 217 if (result.stdout.join('\n').contains('XP')) { | 220 if (result.stdout.join('\n').contains('XP')) { |
| 218 log.error('Sorry, but pub is not supported on Windows XP.'); | 221 log.error('Sorry, but pub is not supported on Windows XP.'); |
| 219 await flushThenExit(exit_codes.USAGE); | 222 await flushThenExit(exit_codes.USAGE); |
| 220 } | 223 } |
| 221 } | 224 } |
| 222 } | 225 } |
| OLD | NEW |