From e849f77d172f63a42288db514af91480a15a9ccf Mon Sep 17 00:00:00 2001 From: Eliseu Egewarth Date: Thu, 17 Aug 2017 16:45:32 -0300 Subject: [PATCH] Adding color for check failures Signed-off-by: Eliseu Egewarth --- check_migrations.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/check_migrations.sh b/check_migrations.sh index 2355c512a..31f042207 100755 --- a/check_migrations.sh +++ b/check_migrations.sh @@ -1,8 +1,17 @@ #!/bin/bash -python manage.py makemigrations --dry-run --exit > /dev/null +python manage.py makemigrations --dry-run --exit MIGRATIONS=$? -[ $MIGRATIONS -eq 0 ] && echo "You have unapplied code change. run 'python manage.py makemigrations'" && exit 1 -[ $MIGRATIONS -ne 0 ] && echo "" && exit 0 \ No newline at end of file +NC='\033[0m' + +if [ $MIGRATIONS -eq 0 ]; then + RED='\033[0;31m' + echo -e "${RED}You have unapplied code changes. run 'python manage.py makemigrations' before submitting your code...${NC}" + exit 1 +else + GREEN='\033[0;32m' + echo -e "Working normally..." + exit 0 +fi \ No newline at end of file