run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  final path = _getPath();
  final outputGenerator = getOutputGenerator();

  final pubspecFiles = PubspecLoader.loadPubspecFiles(path);

  Graph<DependencyNode, DependencyEdge> dependencyGraph;
  try {
    dependencyGraph = DependencyGraphParser.parse(pubspecFiles);
  } on Exception catch (e) {
    throw Exception('Error: Failed to parse dependencies. Details: $e');
  }

  final representation = outputGenerator.toRepresentation(dependencyGraph);
  print(representation);
}