#!/bin/bash
RED='\e[101m'
GREEN='\e[32m'
BOLD='\e[21m'
RESET='\e[0m'

make validate
exit_code="$?"
if [[ "$exit_code" -ne 0 ]]; then
    echo "-----------------------------------------------------------------------------"
    echo -e "--   ${BOLD}PRE-COMMIT HOOK RESULT${RESET}: Document ${RED}DOES NOT${RESET} validate. Aborting commit.  --"
    echo "-----------------------------------------------------------------------------"
    exit $exit_code
else
    echo "---------------------------------------------------------------------------"
    echo -e "--  ${BOLD}PRE-COMMIT HOOK RESULT${RESET}: Document ${GREEN}validates${RESET}. Continuing with commit.  --"
    echo "---------------------------------------------------------------------------"
    exit 0
fi