checkGcloud method

Future<ToolStatus> checkGcloud()

Check if gcloud is installed

Implementation

Future<ToolStatus> checkGcloud() async {
  final bool exists = await _runner.commandExists('gcloud');
  if (!exists) {
    return ToolStatus.missing(
      'Google Cloud SDK',
      'https://cloud.google.com/sdk/docs/install',
      isRequired: false,
    );
  }

  final String? version = await _runner.getCommandVersion(
    'gcloud',
    versionArgs: <String>['--version'],
  );
  // Extract just the first line with version info
  final String versionLine = version?.split('\n').first ?? 'unknown';
  return ToolStatus.installed(
    'Google Cloud SDK',
    versionLine,
    isRequired: false,
  );
}