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 argGitsYaml = argResults.getOptionGitsYaml();

    YamlHelper.validateGitsYaml(argGitsYaml);
    final yaml = YamlHelper.loadFileYaml(argGitsYaml);

    await GitsModularHelper.upgrade(concurrent: yaml.concurrent);
    return;
  }
  var directory = 'gits_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');
  }
  FlutterHelper.start('packages upgrade', workingDirectory: path);
  FlutterHelper.start('packages get', workingDirectory: path);

  StatusHelper.success();
}