From 171c18cc6c3219da46dd0d98fefa01df315b1fcf Mon Sep 17 00:00:00 2001 From: shilangyu Date: Mon, 1 Mar 2021 09:55:30 +0100 Subject: [PATCH] Use `printError` --- scripts/common.dart | 2 +- scripts/migrate_lemmy_l10n.dart | 5 +---- scripts/release.dart | 6 ++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/common.dart b/scripts/common.dart index 5274d17..2dbcf8d 100644 --- a/scripts/common.dart +++ b/scripts/common.dart @@ -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); diff --git a/scripts/migrate_lemmy_l10n.dart b/scripts/migrate_lemmy_l10n.dart index 2236e47..a87c113 100644 --- a/scripts/migrate_lemmy_l10n.dart +++ b/scripts/migrate_lemmy_l10n.dart @@ -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) { diff --git a/scripts/release.dart b/scripts/release.dart index 65ac4d4..d521190 100755 --- a/scripts/release.dart +++ b/scripts/release.dart @@ -7,8 +7,7 @@ Future main(List 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 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.'); } }