| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library command_lish; | 5 library command_lish; |
| 6 | 6 |
| 7 import 'dart:json'; | 7 import 'dart:json'; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 | 9 |
| 10 import '../../pkg/args/lib/args.dart'; | 10 import '../../pkg/args/lib/args.dart'; |
| 11 import '../../pkg/http/lib/http.dart' as http; | 11 import '../../pkg/http/lib/http.dart' as http; |
| 12 import 'pub.dart'; | 12 import 'pub.dart'; |
| 13 import 'io.dart'; | 13 import 'io.dart'; |
| 14 import 'git.dart' as git; | 14 import 'git.dart' as git; |
| 15 import 'oauth2.dart' as oauth2; | 15 import 'oauth2.dart' as oauth2; |
| 16 | 16 |
| 17 // TODO(nweiz): Make "publish" the primary name for this command. See issue | 17 // TODO(nweiz): Make "publish" the primary name for this command. See issue |
| 18 // 6949. | 18 // 6949. |
| 19 /// Handles the `lish` and `publish` pub commands. | 19 /// Handles the `lish` and `publish` pub commands. |
| 20 class LishCommand extends PubCommand { | 20 class LishCommand extends PubCommand { |
| 21 String get description => "publish the current package to pub.dartlang.org"; | 21 final description = "publish the current package to pub.dartlang.org"; |
| 22 String get usage => "pub lish [options]"; | 22 final usage = "pub publish [options]"; |
| 23 final aliases = const ["lish", "lush"]; |
| 23 | 24 |
| 24 ArgParser get commandParser { | 25 ArgParser get commandParser { |
| 25 var parser = new ArgParser(); | 26 var parser = new ArgParser(); |
| 26 parser.addOption('server', defaultsTo: 'http://pub.dartlang.org', | 27 parser.addOption('server', defaultsTo: 'http://pub.dartlang.org', |
| 27 help: 'The package server to which to upload this package'); | 28 help: 'The package server to which to upload this package'); |
| 28 return parser; | 29 return parser; |
| 29 } | 30 } |
| 30 | 31 |
| 31 /// The URL of the server to which to upload the package. | 32 /// The URL of the server to which to upload the package. |
| 32 Uri get server => new Uri.fromString(commandOptions['server']); | 33 Uri get server => new Uri.fromString(commandOptions['server']); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 _invalidServerResponse(response); | 156 _invalidServerResponse(response); |
| 156 } | 157 } |
| 157 throw errorMap['error']['message']; | 158 throw errorMap['error']['message']; |
| 158 } | 159 } |
| 159 | 160 |
| 160 /// Throws an error describing an invalid response from the server. | 161 /// Throws an error describing an invalid response from the server. |
| 161 void _invalidServerResponse(http.Response response) { | 162 void _invalidServerResponse(http.Response response) { |
| 162 throw 'Invalid server response:\n${response.body}'; | 163 throw 'Invalid server response:\n${response.body}'; |
| 163 } | 164 } |
| 164 } | 165 } |
| OLD | NEW |