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

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

Issue 15444003: Use args' command support for pub commands. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Initialize command args in constructor. Created 7 years, 7 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_lish.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command_lish.dart b/sdk/lib/_internal/pub/lib/src/command_lish.dart
index 4d97b52afbcf6b37caed2b19d12ce918c47f3c97..9fc723c8c37faa65068035b30226f16b6ba6082f 100644
--- a/sdk/lib/_internal/pub/lib/src/command_lish.dart
+++ b/sdk/lib/_internal/pub/lib/src/command_lish.dart
@@ -17,6 +17,7 @@ import 'command.dart';
import 'directory_tree.dart';
import 'exit_codes.dart' as exit_codes;
import 'git.dart' as git;
+import 'hosted_source.dart';
import 'http.dart';
import 'io.dart';
import 'log.dart' as log;
@@ -30,19 +31,6 @@ class LishCommand extends PubCommand {
final usage = "pub publish [options]";
final aliases = const ["lish", "lush"];
- ArgParser get commandParser {
- var parser = new ArgParser();
- // TODO(nweiz): Use HostedSource.defaultUrl as the default value once we use
- // dart:io for HTTPS requests.
- parser.addFlag('dry-run', abbr: 'n', negatable: false,
- help: 'Validate but do not publish the package.');
- parser.addFlag('force', abbr: 'f', negatable: false,
- help: 'Publish without confirmation if there are no errors.');
- parser.addOption('server', defaultsTo: 'https://pub.dartlang.org',
- help: 'The package server to which to upload this package.');
- return parser;
- }
-
/// The URL of the server to which to upload the package.
Uri get server => Uri.parse(commandOptions['server']);
@@ -52,6 +40,15 @@ class LishCommand extends PubCommand {
/// Whether the publish requires confirmation.
bool get force => commandOptions['force'];
+ LishCommand() {
+ commandParser.addFlag('dry-run', abbr: 'n', negatable: false,
+ help: 'Validate but do not publish the package.');
+ commandParser.addFlag('force', abbr: 'f', negatable: false,
+ help: 'Publish without confirmation if there are no errors.');
+ commandParser.addOption('server', defaultsTo: HostedSource.DEFAULT_URL,
+ help: 'The package server to which to upload this package.');
+ }
+
Future _publish(packageBytes) {
var cloudStorageUrl;
return oauth2.withClient(cache, (client) {
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command_install.dart ('k') | sdk/lib/_internal/pub/lib/src/command_update.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698