Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Unified Diff: sdk/lib/_internal/pub/lib/src/command.dart

Issue 204983022: Add a hidden flag for specifying pub serve's admin port. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback/build_environment.dart ('k') | sdk/lib/_internal/pub/lib/src/command/serve.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698