Files
sdk/utils/pub/command_list.dart
T
nweiz@google.com 3085912d01 Add support for pub install.
This CL does several things:

* Adds explicit infrastructure for package sources.
* Adds the Dart SDK as such a source.
* Adds an explicit class for managing the packages/ directory (AppCache, as
  opposed to SystemCache).
* Adds an "install" command that installs to packages/, backed up by the system
  cache.

Review URL: https://chromiumcodereview.appspot.com//10340005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7398 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-07 19:58:32 +00:00

31 lines
1.0 KiB
Dart

// 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.
/**
* 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() {
// TODO(nweiz): also list the contents of the packages directory when it's
// able to determine the source of its packages (that is, when we have a
// lockfile).
cache.listAll().then((ids) => _printIds('system cache', ids));
}
_printIds(String title, List<PackageId> ids) {
ids = new List<PackageId>.from(ids);
ids.sort((a, b) => a.compareTo(b));
print('From $title:');
for (var id in ids) {
print(' $id');
}
}
}