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 {
  if (argResults?.wasParsed('all') ?? false) {
    final argMorphemeYaml = argResults.getOptionMorphemeYaml();

    YamlHelper.validateMorphemeYaml(argMorphemeYaml);
    final yaml = YamlHelper.loadFileYaml(argMorphemeYaml);

    await ModularHelper.upgrade(concurrent: yaml.concurrent);
    return;
  }
  var directory = 'morpheme_library';
  if (argResults?.wasParsed('dependency') ?? false) {
    directory = 'dependency_manager';
  }
  final path = join(current, 'core', 'packages', directory);
  if (!exists(path)) {
    StatusHelper.failed(
        'You don\'t have directory "$directory" in project, make sure to have "$directory" first');
  }
  await FlutterHelper.start('packages upgrade', workingDirectory: path);
  await FlutterHelper.start('packages get', workingDirectory: path);

  StatusHelper.success();
}