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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/command/serve.dart

Issue 805393002: Update pub to use the new command runner API in args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 11 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_generated/lib/src/command/serve.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/serve.dart b/sdk/lib/_internal/pub_generated/lib/src/command/serve.dart
index 268f63ae4499f8e03e8452736b6e25d2a12be68a..1111d3dec8e111ec26aadda8900503a060b1eeba 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/command/serve.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/command/serve.dart
@@ -19,35 +19,36 @@ final _arrow = getSpecial('\u2192', '=>');
/// Handles the `serve` pub command.
class ServeCommand extends BarbackCommand {
+ String get name => "serve";
String get description =>
'Run a local web development server.\n\n'
'By default, this serves "web/" and "test/", but an explicit list of \n'
'directories to serve can be provided as well.';
- String get usage => "pub serve [directories...]";
+ String get invocation => "pub serve [directories...]";
String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-serve.html";
PubPackageProvider _provider;
- String get hostname => commandOptions['hostname'];
+ String get hostname => argResults['hostname'];
/// The base port for the servers.
///
/// This will print a usage error and exit if the specified port is invalid.
- int get port => parseInt(commandOptions['port'], 'port');
+ int get port => parseInt(argResults['port'], 'port');
/// The port for the admin UI.
///
/// This will print a usage error and exit if the specified port is invalid.
int get adminPort {
- var adminPort = commandOptions['admin-port'];
+ var adminPort = argResults['admin-port'];
return adminPort == null ? null : parseInt(adminPort, 'admin port');
}
/// `true` if Dart entrypoints should be compiled to JavaScript.
- bool get useDart2JS => commandOptions['dart2js'];
+ bool get useDart2JS => argResults['dart2js'];
/// `true` if the admin server URL should be displayed on startup.
- bool get logAdminUrl => commandOptions['log-admin-url'];
+ bool get logAdminUrl => argResults['log-admin-url'];
BarbackMode get defaultMode => BarbackMode.DEBUG;
@@ -58,11 +59,11 @@ class ServeCommand extends BarbackCommand {
final _completer = new Completer();
ServeCommand() {
- commandParser.addOption(
+ argParser.addOption(
'hostname',
defaultsTo: 'localhost',
help: 'The hostname to listen on.');
- commandParser.addOption(
+ argParser.addOption(
'port',
defaultsTo: '8080',
help: 'The base port to listen on.');
@@ -72,16 +73,16 @@ class ServeCommand extends BarbackCommand {
// Socket interface, we don't want to show it to users, but the tests and
// Editor need this logged to know what port to bind to.
// Remove this (and always log) when #16954 is fixed.
- commandParser.addFlag('log-admin-url', defaultsTo: false, hide: true);
+ argParser.addFlag('log-admin-url', defaultsTo: false, hide: true);
// TODO(nweiz): Make this public when issue 16954 is fixed.
- commandParser.addOption('admin-port', hide: true);
+ argParser.addOption('admin-port', hide: true);
- commandParser.addFlag(
+ argParser.addFlag(
'dart2js',
defaultsTo: true,
help: 'Compile Dart to JavaScript.');
- commandParser.addFlag(
+ argParser.addFlag(
'force-poll',
defaultsTo: false,
help: 'Force the use of a polling filesystem watcher.');
@@ -91,7 +92,7 @@ class ServeCommand extends BarbackCommand {
final completer0 = new Completer();
scheduleMicrotask(() {
try {
- var port = parseInt(commandOptions['port'], 'port');
+ var port = parseInt(argResults['port'], 'port');
join0(x0) {
var adminPort = x0;
join1(x1) {
@@ -183,16 +184,16 @@ class ServeCommand extends BarbackCommand {
}
}, onError: completer0.completeError);
}
- if (commandOptions['force-poll']) {
+ if (argResults['force-poll']) {
join1(WatcherType.POLLING);
} else {
join1(WatcherType.AUTO);
}
}
- if (commandOptions['admin-port'] == null) {
+ if (argResults['admin-port'] == null) {
join0(null);
} else {
- join0(parseInt(commandOptions['admin-port'], 'admin port'));
+ join0(parseInt(argResults['admin-port'], 'admin port'));
}
} catch (e, s) {
completer0.completeError(e, s);
« no previous file with comments | « sdk/lib/_internal/pub_generated/lib/src/command/run.dart ('k') | sdk/lib/_internal/pub_generated/lib/src/command/upgrade.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698