runWithOutput method

  1. @override
Future<void> runWithOutput(
  1. Configuration<ProjectLinkCommandOption> commandConfig,
  2. CommandOutput output
)
override

Runs this command with prepared configuration and output.

Subclasses should override this method.

Implementation

@override
Future<void> runWithOutput(
  final Configuration<ProjectLinkCommandOption> commandConfig,
  final CommandOutput output,
) async {
  final projectId = commandConfig.value(ProjectLinkCommandOption.projectId);
  final dartVersionOverride = commandConfig.optionalValue(
    ProjectLinkCommandOption.dartVersion,
  );
  final projectDirectory = runner.verifiedProjectDirectory();
  final configFilePath =
      globalConfiguration.projectConfigFile?.path ??
      p.join(
        projectDirectory.path,
        ProjectConfigFileConstants.defaultFileName,
      );

  logger.debug('Project directory is: ${projectDirectory.path}');

  await renderCommand(
    output,
    operation: () async => Stream.fromFuture(
      ProjectCommands.linkProject(
        runner.serviceProvider.cloudApiClient,
        projectId: projectId,
        projectDirectory: projectDirectory.path,
        configFilePath: configFilePath,
        dartVersionOverride: dartVersionOverride,
      ),
    ),
    textOutputUi: const ProjectLinkTextUi(),
  );
}