-
Notifications
You must be signed in to change notification settings - Fork 26
/
prettyfier
executable file
·82 lines (81 loc) · 4.19 KB
/
prettyfier
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
GREEN=`echo -e '\033[0;32m'`
GREENBOLD=`echo -e '\033[1;32m'`
RED=`echo -e '\033[0;31m'`
REDBOLD=`echo -e '\033[1;31m'`
WARNING=`echo -e '\033[1;35m'`
FILE=`echo -e '\033[1;37m'`
GREY=`echo -e '\033[2;37m'`
GREYBOLD=`echo -e '\033[1;37m'`
YELLOWBOLD=`echo -e '\033[1;33m'`
KEYWORD=`echo -e '\033[2;36m'`
BUILD=`echo -e '\033[0;35m'`
BLUE=`echo -e '\033[1;34m'`
PURPLE=`echo -e '\033[0;35m'`
PURPLEBOLD=`echo -e '\033[1;35m'`
# DARKGREY=`echo -e '\033[2;37m'`
NORMAL=`echo -e '\033[m'`
$1 ${*:2} 2>&1 | \
sed -u -e "s/\(make\[.*\)/${GREY}\1${NORMAL}/gI" \
-e "s/\(No package .* found\)/${RED}\1${NORMAL}/gI" \
-e "s/\(^[^#]*\)\(\berrors*\b\)/\1${REDBOLD}\2${NORMAL}/gI" \
-e "s/\(^[^#]*\)\(\bwarnings*\b\)/\1${WARNING}\2${NORMAL}/gI" \
-e "s/\(\S*:[0-9]*:[^0-9]\)/${FILE}\1${NORMAL}/gI" \
-e "s/\(^[C^#^-]*\)make /\1${KEYWORD}make ${NORMAL}/gI" \
-e "s/\(^[^#^-]*\)\(rpm\) /\1${KEYWORD}\2 ${NORMAL}/gI" \
-e "s/\(^[^#^[]*\)cp /\1${KEYWORD}cp ${NORMAL}/gI" \
-e "s/\(^[^#^[]*\)rm /\1${KEYWORD}rm ${NORMAL}/gI" \
-e "s/\(^[^#^[]*\)mkdir /\1${KEYWORD}mkdir ${NORMAL}/gI" \
-e "s/\(^[^#^[]*\)CC /\1${BUILD}CC ${NORMAL}/g" \
-e "s/\(^[^#^[]*\)CXX /\1${BUILD}CXX ${NORMAL}/g" \
-e "s/\(^[^#^[]*\)CFG /\1${BUILD}CFG ${NORMAL}/g" \
-e "s/\(^[^#^[]*\)GEN /\1${BUILD}GEN ${NORMAL}/g" \
-e "s/\(^[^#^[]*\)PROV /\1${BUILD}PROV ${NORMAL}/g" \
-e "s/\(^[^#^[]*\)ANT /\1${BUILD}ANT ${NORMAL}/g" \
-e "s/\(^[^#^[^U]*\)LD /\1${BUILD}LD ${NORMAL}/g" \
-e "s/\(^[^#]*\)Note:/\1${GREY}Note:${NORMAL}/gI" \
-e "s/\(^###*\) \(.*\)/${GREY}\1${BLUE} \2${NORMAL}/gI" \
-e "s/\(^#\) \(.*\)/${GREY}\1${BLUE} \2${NORMAL}/gI" \
-e "s/\(^\[.*\]\)\( Built.*$\)/\1${GREY}\2${NORMAL}/gI" \
-e "s/\(^\[.*\]\)\( Bui.*$\)/\1${GREEN}\2${NORMAL}/gI" \
-e "s/\(^\[.*\]\)\( Lin.*$\)/\1${GREENBOLD}\2${NORMAL}/gI" \
-e "s/\(^\[.*\]\)\( .*$\)/\1${BLUE}\2${NORMAL}/gI" \
-e "s/ Passed/ ${GREEN}Passed${NORMAL}/gI" \
-e "s/ Failed:/ ${REDBOLD}Failed:${NORMAL}/gI" \
-e "s/\( Create package using.*$\)/${PURPLEBOLD}\1${NORMAL}/gI" \
-e "s/\(CPack:\)/${GREY}\1${NORMAL}/gI" \
-e "s/\([1-9][0-9]*\) Failed/\1${REDBOLD} Failed${NORMAL}/gI" \
-e "s/\*\*\*Failed /${REDBOLD}\*\*\*Failed${NORMAL} /g" \
-e "s/\(-- \)Installing/\1${PURPLEBOLD}Installing${NORMAL}/g" \
-e "s/\(-- \)Up-to-date/\1${GREY}Up-to-date${NORMAL}/g" \
-e "s/\(-- .*\)YES/\1${GREEN}YES${NORMAL}/g" \
-e "s/\(-- .*\)ON/\1${GREEN}ON${NORMAL}/g" \
-e "s/\(-- .*\)NO\b/\1${REDBOLD}NO${NORMAL}/g" \
-e "s/\(-- .*\)OFF\b/\1${REDBOLD}OFF${NORMAL}/g" \
-e "s/\(-- .*\)\(Found \S*\)/\1${PURPLE}\2${NORMAL}/g" \
-e "s/\(--\s\)\(.*done\)/\1${GREEN}\2${NORMAL}/g" \
-e "s/\(^-- \)/${GREY}--${NORMAL} /g" \
-e "s/\(^\s*\^\)\([~]*\)/${PURPLEBOLD}\1${GREY}\2${NORMAL}/g" \
-e "s/\(^100%\) tests passed/${GREEN}\1 tests passed${NORMAL}/g" \
-e "s/\(^[0-9]*%\) tests passed/${REDBOLD}\1 tests passed${NORMAL}/g" \
-e "s/\(^\[*INFO:*\]*\)/${GREY}\1${NORMAL}/gI" \
-e "s/\(PASS[ed]*\)/${GREEN}\1${NORMAL}/gI" \
-e "s/\(SUCCESS\)/${GREEN}\1${NORMAL}/gI" \
-e "s/\(build complete\)/${GREEN}\1${NORMAL}/gI" \
-e "s/\(FAIL[ed]*\)/${REDBOLD}\1${NORMAL}/g" \
-e "s/\(FAILURE\)/${REDBOLD}\1${NORMAL}/g" \
-e "s/\(^Downloading:\)\(.*\)$/${BLUE}\1${GREY}\2${NORMAL}/gI" \
-e "s/\(^Downloaded:\)\(.*\)$/${GREEN}\1${GREY}\2${NORMAL}/gI" \
-e "s/\(UNKNOWN\)/${GREYBOLD}\1${NORMAL}/gI" \
-e "s/\(WARNING\)/${YELLOWBOLD}\1${NORMAL}/g" \
-e "s/\(OK\)/${GREENBOLD}\1${NORMAL}/g" \
-e "s/\(RSU:\)/${PURPLEBOLD}\1${NORMAL}/g" \
-e "s/\(MOD:\)/${BLUE}\1${NORMAL}/g" \
-e "s/\(True\)/${GREEN}\1${NORMAL}/gI" \
-e "s/\(ERROR\)/${REDBOLD}\1${NORMAL}/g" \
-e "s/\(CRITICAL\)/${REDBOLD}\1${NORMAL}/g" \
-e "s/\(False\)/${RED}\1${NORMAL}/gI" \
-e "s/\([{},'\"=]\)/${GREY}\1${NORMAL}/gI" \
-e "s/\(^[a-zA-Z]\{3\} [0-9]* \)\([0-9:.]\{6,\}\|:\) \([a-zA-Z0-9.\-]*\) \([a-zA-Z0-9.\-]*\)\(\[*[0-9]*\]*\)/${GREY}\2 ${KEYWORD}\4${GREY}\5${NORMAL}/gI" \
-e "s/\(^[0-9]*-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\) - \([a-zA-Z_-]*\)/${GREY}\1 - ${KEYWORD}\2${NORMAL}/gI" \
-e "s/^[+]/${PURPLEBOLD}+${NORMAL}/gI" ; test ${PIPESTATUS[0]} -eq 0