run method

Future<void> run(
  1. List<String> arguments
)

Implementation

Future<void> run(List<String> arguments) async {
  final project = Project(fs: fs, workingDir: workingDir);
  final nextVersionCommand = NextVersionCommand(
    project: project,
    printer: printer,
    git: git,
  );
  final remoteTagIdCommand = RemoteTagIdCommand(
    printer: printer,
    git: git,
  );
  final changelogCommand = ChangelogCommand(
    printer: printer,
    project: project,
    git: git,
    now: now,
  );
  final updateVersionCommand = UpdateVersionCommand(
    printer: printer,
    project: project,
  );
  final updateYearCommand = UpdateYearCommand(
    project: project,
    printer: printer,
    now: now,
  );

  final cmd = CommandRunner(
    "release_tools",
    "A collection of tools to help with creating releases and publishing libraries.",
  )
    ..addCommand(nextVersionCommand)
    ..addCommand(changelogCommand)
    ..addCommand(updateVersionCommand)
    ..addCommand(
      UpdateYearCommand(
        printer: printer,
        project: project,
        now: now,
      ),
    )
    ..addCommand(remoteTagIdCommand)
    ..addCommand(
      CurrentVersionCommand(
        printer: printer,
        project: project,
      ),
    )
    ..addCommand(ShouldReleaseCommand(printer: printer, git: git))
    ..addCommand(
      PrepareReleaseCommand(
        printer: printer,
        nextVersionCommand: nextVersionCommand,
        remoteTagIdCommand: remoteTagIdCommand,
        changelogCommand: changelogCommand,
        updateVersionCommand: updateVersionCommand,
        updateYearCommand: updateYearCommand,
      ),
    )
    ..argParser.addFlag(
      'version',
      abbr: 'v',
      negatable: false,
      help: 'Show release_tools version',
    );
  final args = cmd.argParser.parse(arguments);
  if (args['version'] as bool) {
    printer.println(releaseToolsVersion);
    return;
  }
  await cmd.run(arguments);
}