-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcolormvn
More file actions
executable file
·36 lines (31 loc) · 939 Bytes
/
colormvn
File metadata and controls
executable file
·36 lines (31 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# Adapted from http://blog.blindgaenger.net/colorize_maven_output.html
function colormvn()
{
local Error
local Info
local Warning
local Hyphen
local Success
local settings_file="$HOME/.colormvn"
if [ -e "$settings_file" ]
then
source "$settings_file"
fi
Error=${Error:-"$(tput bold)$(tput setaf 1)"}
Info=${Info:-"$(tput setaf 4)"}
Warning=${Warning:-"$(tput bold)$(tput setaf 3)"}
Hyphen=${Hyphen:-"$(tput setaf 6)"}
Success=${Success:-"$(tput setaf 2)"}
local cmd="mvn $@"
echo "$cmd"
eval "$cmd" | sed \
-e "s:^\[WARNING\].*$:${Warning}&$(tput sgr0):" \
-e "s:^\[ERROR\].*$:${Error}&$(tput sgr0):" \
-e "s:---:${Hyphen}---$(tput sgr0)${Info}:g" \
-e "s:^\[INFO\] \(Building [[:upper:]].*\)$:\[INFO\] ${Hyphen}\1$(tput sgr0):" \
-e "s:FAILURE\|SKIPPED:${Error}&$(tput sgr0):" \
-e "s:SUCCESS:${Success}&$(tput sgr0):" \
-e "s:^\[INFO\].*$:${Info}&$(tput sgr0):"
}
colormvn "$@"