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

Unified Diff: utils/pub/command_list.dart

Issue 10214006: Refactor command code and add support for --help and --version. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 8 years, 8 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
« no previous file with comments | « no previous file | utils/pub/command_update.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/command_list.dart
diff --git a/utils/pub/command_list.dart b/utils/pub/command_list.dart
index e90454489983e5357b5c93654763b10a6d28402a..9de8817e91ac8d4a0c9755997bd961dc98230dc7 100644
--- a/utils/pub/command_list.dart
+++ b/utils/pub/command_list.dart
@@ -2,14 +2,20 @@
// 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.
-/** Handles the `list` pub command. */
-void commandList(PubOptions options, List<String> args) {
- // TODO(rnystrom): Validate args. Right now, this just lists the packages in
- // your cache.
- cache.listAll().then((packages) {
- packages.sort((a, b) => a.name.compareTo(b.name));
- for (final package in packages) {
- print(package.name);
- }
- });
-}
+/**
+ * Handles the `list` pub command. This is mostly just used so we can pull
+ * some basic data out of pub in the integration tests. Once pub is more
+ * full-featured and has other commands that test everything it does, this
+ * may go away.
+ */
+class ListCommand extends PubCommand {
+ String get description() => 'print the contents of repositories';
+
+ void onRun() {
+ cache.listAll().then((packages) {
+ for (final package in packages) {
+ print(package.name);
+ }
+ });
+ }
+}
« no previous file with comments | « no previous file | utils/pub/command_update.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698