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() {
  final targets = argResults?[RenameOption.targets.name];
  final value = argResults?[RenameOption.value.name];
  if (targets == null || targets.isEmpty) {
    print('No targets specified.');
    return null;
  }
  if (value == null || value.isEmpty) {
    print('value required for $name command.');
    return null;
  }

  print('Targets: $targets');
  print('Value: $value');
  final rename = Rename.fromPlatformNames(
    platformNames: targets,
  );
  return rename.applyWithCommandName(
    commandName: name,
    value: value,
  );
}