run method
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 save <file.yaml|file.json>');
}
// Parsed here so a malformed file is a local error naming the file, rather
// than a 400 from a Hub that only ever saw the bytes.
final blueprint = await BlueprintFile.read(rest.first);
final client = _apiClientFrom(argResults!);
try {
await client.saveBlueprint(blueprint);
stdout
..writeln(
'saved "${blueprint.id}" (${blueprint.includes.length} includes, '
'${blueprint.resources.length} resources)',
)
..writeln('assign it with: blueprint assign ${blueprint.id} <node>');
} finally {
client.close();
}
}