Skip to content

Commit ee23322

Browse files
committed
adding colors
1 parent 7e1ceac commit ee23322

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

conventional-pre-commit.sh

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
#!/usr/bin/env bash
22

3+
# Define Color Codes
4+
RESTORE='\033[0m'
5+
RED='\033[00;31m'
6+
GREEN='\033[00;32m'
7+
YELLOW='\033[00;33m'
8+
BLUE='\033[00;34m'
9+
PURPLE='\033[00;35m'
10+
CYAN='\033[00;36m'
11+
LIGHTGRAY='\033[00;37m'
12+
13+
LRED='\033[01;31m'
14+
LGREEN='\033[01;32m'
15+
LYELLOW='\033[01;33m'
16+
LBLUE='\033[01;34m'
17+
LPURPLE='\033[01;35m'
18+
LCYAN='\033[01;36m'
19+
WHITE='\033[01;37m'
20+
21+
function test_colors(){
22+
23+
echo -e "${GREEN}Hello ${CYAN}THERE${RESTORE} Restored here ${LCYAN}HELLO again ${RED} Red socks aren't sexy ${BLUE} neither are blue ${RESTORE} "
24+
25+
}
26+
27+
328
# list of Conventional Commits types
429
cc_types=("feat" "fix")
530
default_types=("build" "chore" "ci" "docs" "${cc_types[@]}" "perf" "refactor" "revert" "style" "test")
@@ -34,25 +59,25 @@ if grep -Eq "$pattern" "$msg_file"; then
3459
exit 0
3560
fi
3661

37-
echo "[Commit message] $( cat "$msg_file" )"
38-
echo "
62+
echo -e "${LRED}[Bad Commit message] >> ${RESTORE} \"$( cat "$msg_file" )\""
63+
echo -e "${YELLOW}
3964
Your commit message does not follow Conventional Commits formatting
40-
https://www.conventionalcommits.org/
65+
${LBLUE}https://www.conventionalcommits.org/${YELLOW}
4166
4267
Conventional Commits start with one of the below types, followed by a colon,
43-
followed by the commit message:
68+
followed by the commit message:${RESTORE}
4469
4570
$(IFS=' '; echo "${types[*]}")
4671
47-
Example commit message adding a feature:
72+
${YELLOW}Example commit message adding a feature:${RESTORE}
4873
4974
feat: implement new API
5075
51-
Example commit message fixing an issue:
76+
${YELLOW}Example commit message fixing an issue:${RESTORE}
5277
5378
fix: remove infinite loop
5479
55-
Optionally, include a scope in parentheses after the type for more context:
80+
${YELLOW}Optionally, include a scope in parentheses after the type for more context:{$RESTORE}
5681
5782
fix(account): remove infinite loop
5883
"

0 commit comments

Comments
 (0)