28 lines
595 B
Bash
Executable File
28 lines
595 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# get bash colors and styles here:
|
|
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
|
|
C_RESET='\e[0m'
|
|
C_RED='\e[31m'
|
|
C_GREEN='\e[32m'
|
|
C_YELLOW='\e[33m'
|
|
|
|
function __run() #(step, name, cmd)
|
|
{
|
|
local color output exitcode
|
|
|
|
printf "${C_YELLOW}[%s]${C_RESET} %-20s" "$1" "$2"
|
|
output=$(eval "$3" 2>&1)
|
|
exitcode=$?
|
|
|
|
if [[ 0 == $exitcode ]]; then
|
|
echo -e "${C_GREEN}OK!${C_RESET}"
|
|
else
|
|
echo -e "${C_RED}ERROR! (${exitcode})${C_RESET}\n\n$output"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
__run "1/1" "Check JAVA code format" "mvn formatter:validate"
|
|
|