Chromium Code Reviews| Index: sdk/lib/_internal/pub/lib/src/command.dart |
| diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart |
| index fe899cdbae66a62604e1bd516d4f4c52786c2c63..e8b7ed0e09fa14a9589802d0ed8de194b61dd5bc 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/command.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/command.dart |
| @@ -31,7 +31,7 @@ import 'utils.dart'; |
| /// The base class for commands for the pub executable. |
| abstract class PubCommand { |
| - /// The commands that Pub understands. |
| + /// The commands that pub understands. |
| static final Map<String, PubCommand> commands = _initCommands(); |
| SystemCache cache; |
| @@ -52,9 +52,13 @@ abstract class PubCommand { |
| String get usage; |
| /// Whether or not this command requires [entrypoint] to be defined. If false, |
| - /// Pub won't look for a pubspec and [entrypoint] will be null when the |
| + /// pub won't look for a pubspec and [entrypoint] will be null when the |
| /// command runs. |
| - final requiresEntrypoint = true; |
| + bool get requiresEntrypoint => true; |
|
nweiz
2013/10/16 21:46:32
Why is this a getter now?
Bob Nystrom
2013/10/29 01:02:12
Kind of pedantic here, but there's no point in add
nweiz
2013/10/29 19:21:33
I don't think this communicates what you're trying
Bob Nystrom
2013/10/29 19:43:42
For me, this isn't an optimization issue. I don't
nweiz
2013/10/29 21:03:08
A final field with a constant value isn't state. I
|
| + |
| + /// Whether or not this command takes arguments in addition to options. If |
| + /// false, pub will exit with an error if arguments are provided. |
| + bool get takesArguments => false; |
| /// Alternate names for this command. These names won't be used in the |
| /// documentation, but they will work when invoked on the command line. |
| @@ -117,6 +121,13 @@ and include the results in a bug report on http://dartbug.com/new. |
| } |
| new Future.sync(() { |
| + // Make sure there aren't unexpected arguments. |
| + if (!takesArguments && commandOptions.rest.isNotEmpty) { |
| + log.error('Command does not take any arguments.'); |
|
nweiz
2013/10/16 21:46:32
Include the command name.
Bob Nystrom
2013/10/29 01:02:12
Done.
|
| + this.printUsage(); |
| + return flushThenExit(exit_codes.USAGE); |
| + } |
| + |
| if (requiresEntrypoint) { |
| // TODO(rnystrom): Will eventually need better logic to walk up |
| // subdirectories until we hit one that looks package-like. For now, |