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 {
  oldName = argResults?['old-name'] ?? '';
  newName = argResults?['new-name'] ?? '';

  if (oldName == newName) return;

  includeLibrary = argResults?['include-library'] ?? false;

  addOrUpdateProjectNameMorphemeYaml();
  refactorProjectNamePubspec();
  await refactorProject();

  if (includeLibrary) await refactorLibrary();

  if (exists(join(current, 'morpheme_library_temp'))) {
    deleteDir(join(current, 'morpheme_library_temp'));
  }

  await 'morpheme get'.run;

  StatusHelper.success('morpheme refactor');
}