runWithOutput method
Future<void>
runWithOutput(
- Configuration<
LogoutCommandOption> commandConfig, - CommandOutput output
override
Runs this command with prepared configuration and output.
Subclasses should override this method.
Implementation
@override
Future<void> runWithOutput(
final Configuration<LogoutCommandOption> commandConfig,
final CommandOutput output,
) async {
final tokenIds = commandConfig.value(LogoutCommandOption.tokenId);
final all = commandConfig.value(LogoutCommandOption.all);
final localStoragePath = globalConfiguration.scloudDir;
final cloudData = await ResourceManager.tryFetchServerpodCloudAuthData(
localStoragePath: localStoragePath.path,
logger: logger,
);
if (cloudData == null) {
await renderCommand(
output,
operation: () async => const {'hadCredentials': false},
textOutputUi: const AuthLogoutTextUi(),
);
return;
}
await renderCommand(
output,
operation: () => Auth.logout(
runner.serviceProvider.cloudApiClient,
localStoragePath: localStoragePath.path,
tokenIds: tokenIds,
all: all,
),
textOutputUi: const AuthLogoutTextUi(),
);
}