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 {
  // Load config and determine doc file path

  final result = await version(
    gitRoot: Directory.current,
    dartRoot: Directory.current,
    badge: badge,
    baseRef: baseRef,
    tag: tag,
    commit: commit,
    generateChangelog: generateChangelog,
    cache: cache,
    isPreRelease: preRelease,
    tagPrefix: tagPrefix,
  );

  if (json != null) {
    final jsonFile = File(json!);
    if (!jsonFile.existsSync()) {
      jsonFile.createSync(recursive: true);
    }
    await jsonFile.writeAsString(jsonEncode(result.toJson()));
  }
}