doRun method
Implementation
@override
Future<int> doRun() async {
const fs = IOFileSystem();
final pubspecExists = await Spec.exists(fs);
if (!pubspecExists) {
return error(1,
message: 'You should run command from project root directory.');
}
final issueUrl = config.issueUrl;
if (issueUrl == null) {
return error(1,
message: 'issue_url is not set in alex config. '
'Add `issue_url: <base url>` to alex.yaml or to the alex section '
'of pubspec.yaml.');
}
final changelog = Changelog(fs);
if (!(await changelog.exists)) {
return error(1, message: 'CHANGELOG.md is not found.');
}
final count = await changelog.linkIssueReferences(issueUrl);
if (count != 0) await changelog.save();
if (isJsonFormat) {
return jsonResult(
exitCode: 0,
summary: '$count reference(s) updated',
data: <String, dynamic>{'updated': count},
);
}
return success(
message: count == 0
? 'No plain issue references to update.'
: 'Updated $count issue reference(s).',
);
}