run method

  1. @override
void run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
void run() async {
  try {
    // Validate inputs
    if (!_validateInputs()) return;

    // Prepare configuration (always generate from json2dart)
    final config = _prepareConfiguration();

    // Validate configuration
    if (!_configManager.validateConfig(config)) return;

    // Execute generation
    final success = await _executeGeneration(config);

    if (success) {
      _reportSuccess();
    }
  } catch (e, stackTrace) {
    StatusHelper.failed(
      'Endpoint generation failed: $e',
      suggestion: 'Check your configuration and try again',
      examples: [
        'morpheme generate endpoint --help',
        'morpheme generate endpoint',
      ],
    );
    print('Stack trace: $stackTrace');
  }
}