run method

  1. @override
Future<void> run()
override

Run the command

Implementation

@override
Future<void> run() async {
  try {
    // Detect ServerPod project
    _project = ServerPodLocator.getProject();
    if (_project == null || !_project!.isValid) {
      ConsoleHelper.error('Not a valid ServerPod project');
      ConsoleHelper.error('Please run this command from within a ServerPod project.');
      exit(1);
    }

    // Initialize with defaults
    _config = const InstallConfig();

    // Display header
    ConsoleHelper.header(
      'ServerPod Boost Installation',
      subtitle: 'v0.1.0',
    );

    ConsoleHelper.info('Project: ${_project!.rootPath}');
    ConsoleHelper.info('Server: ${_project!.serverPath}');
    ConsoleHelper.newLine();

    // Check for command-line flags
    final args = _parseArgs();

    if (args['nonInteractive'] != true) {
      await _runInteractive();
    } else {
      await _runNonInteractive(args);
    }

    ConsoleHelper.outro(
      'Installation complete! 🚀',
      link: 'https://github.com/serverpod/serverpod_boost',
    );
  } catch (e) {
    ConsoleHelper.error('Installation failed: $e');
    exit(1);
  }
}