run method

  1. @override
FutureOr run()
override

Runs this command.

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

Implementation

@override
FutureOr run() async {
  final config = loadConfig();
  final dir = CliHelper.pathToDir(config.parts, projectDir);

  final parts = dir
      .listSync(recursive: true, followLinks: false)
      .where((e) => e.path.endsWith('.part.arb'))
      .map((e) => File(e.path))
      .toList();

  for (final part in parts) {
    final newPath = part.path.replaceAll('.part.arb', '.part.yaml');
    part.renameSync(newPath);
    logger.info('Migrate file ${part.path}');
  }
}