run method

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

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 projectDir = findNitroProjectRoot();
  if (projectDir == null) {
    if (_headless) {
      stderr.writeln('[nitro:error] No Nitro project found in . or its subdirectories.');
    } else {
      stderr.writeln(red('❌ No Nitro project found in . or its subdirectories.'));
    }
    exit(1);
  }

  final editor = argResults?['editor'] as String;
  await openInEditor(editor, projectDir.path, headless: _headless);
}