Skip to content

Commit d3f4b78

Browse files
authored
Merge pull request #21 from jeeftor/main
Adding some colors to the commit script
2 parents 1c26289 + 7dfb903 commit d3f4b78

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

conventional-pre-commit.sh

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

3+
# Define Color Codes
4+
LBLUE='\033[00;34m'
5+
LRED='\033[01;31m'
6+
RESTORE='\033[0m'
7+
YELLOW='\033[00;33m'
8+
39
# list of Conventional Commits types
410
cc_types=("feat" "fix")
511
default_types=("build" "chore" "ci" "docs" "${cc_types[@]}" "perf" "refactor" "revert" "style" "test")
@@ -34,25 +40,25 @@ if grep -Eq "$pattern" "$msg_file"; then
3440
exit 0
3541
fi
3642

37-
echo "[Commit message] $( cat "$msg_file" )"
38-
echo "
43+
echo -e "${LRED}[Bad Commit message] >> ${RESTORE} \"$( cat "$msg_file" )\""
44+
echo -e "${YELLOW}
3945
Your commit message does not follow Conventional Commits formatting
40-
https://www.conventionalcommits.org/
46+
${LBLUE}https://www.conventionalcommits.org/${YELLOW}
4147
4248
Conventional Commits start with one of the below types, followed by a colon,
43-
followed by the commit message:
49+
followed by the commit message:${RESTORE}
4450
4551
$(IFS=' '; echo "${types[*]}")
4652
47-
Example commit message adding a feature:
53+
${YELLOW}Example commit message adding a feature:${RESTORE}
4854
4955
feat: implement new API
5056
51-
Example commit message fixing an issue:
57+
${YELLOW}Example commit message fixing an issue:${RESTORE}
5258
5359
fix: remove infinite loop
5460
55-
Optionally, include a scope in parentheses after the type for more context:
61+
${YELLOW}Optionally, include a scope in parentheses after the type for more context:${RESTORE}
5662
5763
fix(account): remove infinite loop
5864
"

0 commit comments

Comments
 (0)