| 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 c155f32ad71e48c090ad1cb5d8112ad7b29514b5..591704db2c5312fb3b54c5795f08973730a0fc13 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/command.dart
|
| @@ -21,6 +21,8 @@ import 'command/upgrade.dart';
|
| import 'command/uploader.dart';
|
| import 'command/version.dart';
|
| import 'entrypoint.dart';
|
| +import 'exit_codes.dart' as exit_codes;
|
| +import 'io.dart';
|
| import 'log.dart' as log;
|
| import 'system_cache.dart';
|
| import 'utils.dart';
|
| @@ -204,6 +206,17 @@ abstract class PubCommand {
|
| throw new DataException(message);
|
| }
|
|
|
| + /// Parses a user-supplied integer [intString] named [name].
|
| + ///
|
| + /// If the parsing fails, prints a usage message and exits.
|
| + int parseInt(String intString, String name) {
|
| + try {
|
| + return int.parse(intString);
|
| + } on FormatException catch (_) {
|
| + usageError('Could not parse $name "$intString".');
|
| + }
|
| + }
|
| +
|
| /// Generates a string of usage information for this command.
|
| String _getUsage() {
|
| var buffer = new StringBuffer();
|
|
|