Chromium Code Reviews| Index: utils/pub/command_list.dart |
| diff --git a/utils/pub/command_list.dart b/utils/pub/command_list.dart |
| index 8a45cfcd72d6ecd22730d47da956a82317fdc66b..138037667b48b69f23ec4435facb738c42f355d5 100644 |
| --- a/utils/pub/command_list.dart |
| +++ b/utils/pub/command_list.dart |
| @@ -12,11 +12,23 @@ class ListCommand extends PubCommand { |
| String get description() => 'print the contents of repositories'; |
| void onRun() { |
| - cache.listAll().then((packages) { |
| - packages.sort((a, b) => a.name.compareTo(b.name)); |
| - for (final package in packages) { |
| - print(package.name); |
| + printIds(String title, List<PackageId> ids) { |
|
Bob Nystrom
2012/05/03 00:15:49
I would go ahead and make this a method. Part of t
nweiz
2012/05/04 01:03:43
Done.
|
| + ids = new List<PackageId>.from(ids); |
|
Bob Nystrom
2012/05/03 00:15:49
How about making PackageId implement Comparable?
nweiz
2012/05/04 01:03:43
Done.
|
| + ids.sort((a, b) { |
| + var sourceComp = a.source.name.compareTo(b.source.name); |
| + if (sourceComp != 0) return sourceComp; |
| + return a.name.compareTo(b.name); |
| + }); |
| + |
| + print('From $title:'); |
| + for (var id in ids) { |
| + print(' $id'); |
| } |
| - }); |
| + } |
| + |
| + // TODO(nweiz): also list the contents of the application cache when it's |
| + // able to determine the source of its packages (that is, when we have a |
| + // lockfile). |
| + systemCache.listAll().then((ids) => printIds('system cache', ids)); |
| } |
| } |