From 5f9b275e55e84d5c903ec7b351451b1a23498520 Mon Sep 17 00:00:00 2001 From: Raphael Beer Date: Tue, 10 Mar 2020 17:44:51 +0100 Subject: [PATCH] add colors to 'not sorted' messages and hint to --fix feature --- scripts/translations/sort.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/translations/sort.sh b/scripts/translations/sort.sh index 35496f27e..aa5737de8 100755 --- a/scripts/translations/sort.sh +++ b/scripts/translations/sort.sh @@ -3,6 +3,12 @@ ROOT_DIR=$(dirname "$0")/../.. tmp=$(mktemp) exit_code=0 +errors=0 + +TEXT_RED="\e[31m" +TEXT_BLUE="\e[34m" +TEXT_RESET="\e[0m" +TEXT_BOLD="\e[1m" for locale_file in $ROOT_DIR/webapp/locales/*.json do @@ -16,9 +22,13 @@ do : # all good else exit_code=$? - echo "$(basename -- $locale_file) is not sorted by keys" + echo -e "${TEXT_BOLD}${TEXT_RED}>>> $(basename -- $locale_file) is not sorted by keys <<<${TEXT_RESET}" + errors=1 fi fi done +[ "$errors" = 1 ] && echo -e "${TEXT_BOLD}${TEXT_BLUE}Please run $0 --fix to sort your locale definitions!${TEXT_RESET}"; + + exit $exit_code