| 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 pub.command; | 5 library pub.command; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 help: 'Control output verbosity.', | 288 help: 'Control output verbosity.', |
| 289 allowed: ['normal', 'io', 'solver', 'all'], | 289 allowed: ['normal', 'io', 'solver', 'all'], |
| 290 allowedHelp: { | 290 allowedHelp: { |
| 291 'normal': 'Show errors, warnings, and user messages.', | 291 'normal': 'Show errors, warnings, and user messages.', |
| 292 'io': 'Also show IO operations.', | 292 'io': 'Also show IO operations.', |
| 293 'solver': 'Show steps during version resolution.', | 293 'solver': 'Show steps during version resolution.', |
| 294 'all': 'Show all output including internal tracing messages.' | 294 'all': 'Show all output including internal tracing messages.' |
| 295 }); | 295 }); |
| 296 argParser.addFlag('verbose', abbr: 'v', negatable: false, | 296 argParser.addFlag('verbose', abbr: 'v', negatable: false, |
| 297 help: 'Shortcut for "--verbosity=all".'); | 297 help: 'Shortcut for "--verbosity=all".'); |
| 298 argParser.addFlag('with-prejudice', hide: !isAprilFools, negatable: false, |
| 299 help: 'Execute commands with prejudice.'); |
| 298 | 300 |
| 299 // Register the commands. | 301 // Register the commands. |
| 300 PubCommand.mainCommands.forEach((name, command) { | 302 PubCommand.mainCommands.forEach((name, command) { |
| 301 _registerCommand(name, command, argParser); | 303 _registerCommand(name, command, argParser); |
| 302 }); | 304 }); |
| 303 | 305 |
| 304 return argParser; | 306 return argParser; |
| 305 } | 307 } |
| 306 | 308 |
| 307 /// Registers a [command] with [name] on [parser]. | 309 /// Registers a [command] with [name] on [parser]. |
| 308 void _registerCommand(String name, PubCommand command, ArgParser parser) { | 310 void _registerCommand(String name, PubCommand command, ArgParser parser) { |
| 309 parser.addCommand(name, command.commandParser); | 311 parser.addCommand(name, command.commandParser); |
| 310 | 312 |
| 311 // Recursively wire up any subcommands. | 313 // Recursively wire up any subcommands. |
| 312 command.subcommands.forEach((name, subcommand) { | 314 command.subcommands.forEach((name, subcommand) { |
| 313 _registerCommand(name, subcommand, command.commandParser); | 315 _registerCommand(name, subcommand, command.commandParser); |
| 314 }); | 316 }); |
| 315 } | 317 } |
| OLD | NEW |