| Index: sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
|
| diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart b/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
|
| index 5e6e76aff1e882c8584a9df57947d1a01ac65e83..20c8c98a804e5da97421e03594528dc5b1bb90be 100644
|
| --- a/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
|
| +++ b/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
|
| @@ -1,6 +1,13 @@
|
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| library pub.command.uploader;
|
| +
|
| import 'dart:async';
|
| +
|
| import 'package:path/path.dart' as path;
|
| +
|
| import '../command.dart';
|
| import '../entrypoint.dart';
|
| import '../exit_codes.dart' as exit_codes;
|
| @@ -9,13 +16,18 @@ import '../io.dart';
|
| import '../log.dart' as log;
|
| import '../oauth2.dart' as oauth2;
|
| import '../source/hosted.dart';
|
| +
|
| +/// Handles the `uploader` pub command.
|
| class UploaderCommand extends PubCommand {
|
| String get description =>
|
| "Manage uploaders for a package on pub.dartlang.org.";
|
| String get usage => "pub uploader [options] {add/remove} <email>";
|
| String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-uploader.html";
|
| bool get takesArguments => true;
|
| +
|
| + /// The URL of the package hosting server.
|
| Uri get server => Uri.parse(commandOptions['server']);
|
| +
|
| UploaderCommand() {
|
| commandParser.addOption(
|
| 'server',
|
| @@ -26,13 +38,17 @@ class UploaderCommand extends PubCommand {
|
| help: 'The package whose uploaders will be modified.\n'
|
| '(defaults to the current package)');
|
| }
|
| +
|
| Future onRun() {
|
| if (commandOptions.rest.isEmpty) {
|
| log.error('No uploader command given.');
|
| this.printUsage();
|
| return flushThenExit(exit_codes.USAGE);
|
| }
|
| +
|
| var rest = commandOptions.rest.toList();
|
| +
|
| + // TODO(rnystrom): Use subcommands for these.
|
| var command = rest.removeAt(0);
|
| if (!['add', 'remove'].contains(command)) {
|
| log.error('Unknown uploader command "$command".');
|
| @@ -43,6 +59,7 @@ class UploaderCommand extends PubCommand {
|
| this.printUsage();
|
| return flushThenExit(exit_codes.USAGE);
|
| }
|
| +
|
| return new Future.sync(() {
|
| var package = commandOptions['package'];
|
| if (package != null) return package;
|
| @@ -56,7 +73,7 @@ class UploaderCommand extends PubCommand {
|
| return client.post(url, headers: PUB_API_HEADERS, body: {
|
| "email": uploader
|
| });
|
| - } else {
|
| + } else { // command == 'remove'
|
| var url = server.resolve(
|
| "/api/packages/" "${Uri.encodeComponent(package)}/uploaders/"
|
| "${Uri.encodeComponent(uploader)}");
|
|
|