| Index: pkg/args/lib/src/help_command.dart
|
| diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/help.dart b/pkg/args/lib/src/help_command.dart
|
| similarity index 51%
|
| copy from sdk/lib/_internal/pub_generated/lib/src/command/help.dart
|
| copy to pkg/args/lib/src/help_command.dart
|
| index aac7ff9f315089043c7af25428515f0c79a2bf06..041a11524790844f61d9e3d76c0d33ee28eb72f8 100644
|
| --- a/sdk/lib/_internal/pub_generated/lib/src/command/help.dart
|
| +++ b/pkg/args/lib/src/help_command.dart
|
| @@ -1,33 +1,34 @@
|
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library pub.command.help;
|
| +library args.help_command;
|
|
|
| -import 'dart:async';
|
| +import '../command_runner.dart';
|
|
|
| -import '../command.dart';
|
| +/// The built-in help command that's added to every [CommandRunner].
|
| +///
|
| +/// This command displays help information for the various subcommands.
|
| +class HelpCommand extends Command {
|
| + final name = "help";
|
| + String get description =>
|
| + "Display help information for ${runner.executableName}.";
|
| + String get usage => "${runner.executableName} help [command]";
|
|
|
| -/// Handles the `help` pub command.
|
| -class HelpCommand extends PubCommand {
|
| - String get description => "Display help information for Pub.";
|
| - String get usage => "pub help [command]";
|
| - bool get takesArguments => true;
|
| -
|
| - Future onRun() {
|
| + void run() {
|
| // Show the default help if no command was specified.
|
| - if (commandOptions.rest.isEmpty) {
|
| - PubCommand.printGlobalUsage();
|
| - return null;
|
| + if (options.rest.isEmpty) {
|
| + runner.printUsage();
|
| + return;
|
| }
|
|
|
| // Walk the command tree to show help for the selected command or
|
| // subcommand.
|
| - var commands = PubCommand.mainCommands;
|
| + var commands = runner.topLevelCommands;
|
| var command = null;
|
| - var commandString = "pub";
|
| + var commandString = runner.executableName;
|
|
|
| - for (var name in commandOptions.rest) {
|
| + for (var name in options.rest) {
|
| if (commands.isEmpty) {
|
| command.usageError(
|
| 'Command "$commandString" does not expect a subcommand.');
|
| @@ -35,9 +36,7 @@ class HelpCommand extends PubCommand {
|
|
|
| if (commands[name] == null) {
|
| if (command == null) {
|
| - PubCommand.usageErrorWithCommands(
|
| - commands,
|
| - 'Could not find a command named "$name".');
|
| + runner.usageError('Could not find a command named "$name".');
|
| }
|
|
|
| command.usageError(
|
| @@ -50,6 +49,5 @@ class HelpCommand extends PubCommand {
|
| }
|
|
|
| command.printUsage();
|
| - return null;
|
| }
|
| }
|
|
|