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 rest = argResults!.rest;
  if (rest.isEmpty) throw CliError('usage: blueprint resolved <id>');

  final client = _apiClientFrom(argResults!);
  try {
    final resolved = await client.resolvedBlueprint(rest.first);

    stdout.writeln(resolved.hash);
    stdout.writeln('RESOURCE                       ENSURE     FROM');
    for (final r in resolved.resources) {
      final from = r.overrides == null
          ? r.origin
          : '${r.origin} (overrides ${r.overrides})';
      stdout.writeln(
        '${r.id.toString().padRight(30)} '
        '${r.ensure.name.padRight(10)} $from',
      );
    }
    for (final note in resolved.notes) {
      stdout.writeln('note: $note');
    }
  } finally {
    client.close();
  }
}