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 {
    // Parse and validate arguments
    _parseArguments();

    if (_oldName == _newName) {
      printMessage(
          '⚠️  Old and new names are identical. No refactoring needed.');
      return;
    }

    printMessage('🔄 Starting refactoring process...');
    printMessage('Old name: $_oldName');
    printMessage('New name: $_newName');
    printMessage('Include library: $_includeLibrary');

    // Execute refactoring steps
    await _executeRefactoringProcess();

    printMessage('✨ Refactoring completed successfully!');
    StatusHelper.success('morpheme refactor');
  } catch (e) {
    StatusHelper.failed('Refactoring failed: $e');
  }
}