| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 pub.command.list; | 5 library pub.command.list; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import '../ascii_tree.dart' as tree; | 10 import '../ascii_tree.dart' as tree; |
| 11 import '../command.dart'; | 11 import '../command.dart'; |
| 12 import '../log.dart' as log; | 12 import '../log.dart' as log; |
| 13 import '../package.dart'; | 13 import '../package.dart'; |
| 14 import '../package_graph.dart'; | 14 import '../package_graph.dart'; |
| 15 import '../utils.dart'; | 15 import '../utils.dart'; |
| 16 | 16 |
| 17 /// Handles the `deps` pub command. | 17 /// Handles the `deps` pub command. |
| 18 class DepsCommand extends PubCommand { | 18 class DepsCommand extends PubCommand { |
| 19 String get description => "Print package dependencies."; | 19 String get description => "Print package dependencies."; |
| 20 List<String> get aliases => const ["dependencies", "tab"]; | 20 List<String> get aliases => const ["dependencies", "tab"]; |
| 21 String get usage => "pub deps"; | 21 String get usage => "pub deps"; |
| 22 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-deps.html"; |
| 22 | 23 |
| 23 /// The loaded package graph. | 24 /// The loaded package graph. |
| 24 PackageGraph _graph; | 25 PackageGraph _graph; |
| 25 | 26 |
| 26 /// The [StringBuffer] used to accumulate the output. | 27 /// The [StringBuffer] used to accumulate the output. |
| 27 StringBuffer _buffer; | 28 StringBuffer _buffer; |
| 28 | 29 |
| 29 DepsCommand() { | 30 DepsCommand() { |
| 30 commandParser.addOption("style", abbr: "s", | 31 commandParser.addOption("style", abbr: "s", |
| 31 help: "How output should be displayed.", | 32 help: "How output should be displayed.", |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 Set<String> _getTransitiveDependencies() { | 179 Set<String> _getTransitiveDependencies() { |
| 179 var transitive = _graph.packages.keys.toSet(); | 180 var transitive = _graph.packages.keys.toSet(); |
| 180 var root = entrypoint.root; | 181 var root = entrypoint.root; |
| 181 transitive.remove(root.name); | 182 transitive.remove(root.name); |
| 182 transitive.removeAll(root.dependencies.map((dep) => dep.name)); | 183 transitive.removeAll(root.dependencies.map((dep) => dep.name)); |
| 183 transitive.removeAll(root.devDependencies.map((dep) => dep.name)); | 184 transitive.removeAll(root.devDependencies.map((dep) => dep.name)); |
| 184 transitive.removeAll(root.dependencyOverrides.map((dep) => dep.name)); | 185 transitive.removeAll(root.dependencyOverrides.map((dep) => dep.name)); |
| 185 return transitive; | 186 return transitive; |
| 186 } | 187 } |
| 187 } | 188 } |
| OLD | NEW |