1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-23 06:25:29 +01:00

Use printError

This commit is contained in:
shilangyu 2021-03-01 09:55:30 +01:00
parent 5c989679b6
commit 171c18cc6c
3 changed files with 4 additions and 9 deletions

View File

@ -13,7 +13,7 @@ void confirm(String message) {
}
}
void printError(String message, {bool shouldExit = false}) {
void printError(String message, {bool shouldExit = true}) {
stderr.writeln('\x1B[31m$message\x1B[0m');
if (shouldExit) exit(1);

View File

@ -199,10 +199,7 @@ void portStrings(
final renamedKey = extract.value ?? key;
if (!lemmyTranslations[baseLanguage].containsKey(key)) {
printError(
'"$key" does not exist in $repoName',
shouldExit: true,
);
printError('"$key" does not exist in $repoName');
}
if (lemmurTranslations[baseLanguage].containsKey(key) && !force) {

View File

@ -7,8 +7,7 @@ Future<void> main(List<String> args) async {
await assertNoStagedGit();
if (args.isEmpty || !{'patch', 'minor', 'major'}.contains(args[0])) {
print('Unknown version bump type');
exit(1);
printError('Unknown version bump type');
}
final version = await bumpedVersion(args[0]);
@ -28,8 +27,7 @@ Future<void> assertNoStagedGit() async {
await Process.run('git', ['diff-index', '--cached', '--quiet', 'HEAD']);
if (res.exitCode != 0) {
print('You have staged files, commit or unstage them.');
exit(1);
printError('You have staged files, commit or unstage them.');
}
}