-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
#!/bin/bash | ||
COMMIT_MSG=$1 | ||
prefix=$(head -n 1 $COMMIT_MSG | awk '{ print $1 }') | ||
emoji="" | ||
case $prefix in | ||
"fix:") | ||
emoji=":bug:" | ||
;; | ||
"feat:") | ||
emoji=":sparkles:" | ||
;; | ||
"hammer:") | ||
emoji=":hammer:" | ||
;; | ||
"delete:") | ||
emoji=":zap:" | ||
;; | ||
"uppkg:") | ||
emoji=":arrow_up:" | ||
;; | ||
"docs:") | ||
emoji=":memo:" | ||
;; | ||
"style:") | ||
emoji=":art:" | ||
;; | ||
"refactor:") | ||
emoji=":recycle:" | ||
;; | ||
"chore:") | ||
emoji=":hammer:" | ||
;; | ||
"tag:") | ||
emoji=":bookmark:" | ||
;; | ||
"typo:") | ||
emoji=":pencil2:" | ||
;; | ||
"revert:" | "Revert") | ||
emoji=":rewind:" | ||
;; | ||
*) | ||
echo "The specified prefix is undefined."; | ||
exit 1 | ||
;; | ||
esac | ||
|
||
sed -i "s/$prefix/$emoji/" $COMMIT_MSG | ||
|
||
echo $prefix | ||
exit 0 | ||
COMMIT_MSG=$1 | ||
|
||
prefix=$(head -n 1 "$COMMIT_MSG" | awk '{ print $1 }') | ||
emoji="" | ||
case $prefix in | ||
"fix:") | ||
emoji=":bug:" | ||
;; | ||
"feat:") | ||
emoji=":sparkles:" | ||
;; | ||
"hammer:") | ||
emoji=":hammer:" | ||
;; | ||
"delete:") | ||
emoji=":zap:" | ||
;; | ||
"uppkg:") | ||
emoji=":arrow_up:" | ||
;; | ||
"docs:") | ||
emoji=":memo:" | ||
;; | ||
"style:") | ||
emoji=":art:" | ||
;; | ||
"refactor:") | ||
emoji=":recycle:" | ||
;; | ||
"chore:") | ||
emoji=":hammer:" | ||
;; | ||
"tag:") | ||
emoji=":bookmark:" | ||
;; | ||
"typo:") | ||
emoji=":pencil2:" | ||
;; | ||
"revert:" | "Revert") | ||
emoji=":rewind:" | ||
;; | ||
*) | ||
echo "The specified prefix is undefined." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
awk -v prefix="$prefix" -v emoji="$emoji" 'NR==1 { sub(^ prefix, emoji); print } NR!=1' "$COMMIT_MSG" > tmpfile && mv tmpfile "$COMMIT_MSG" | ||
|
||
echo $prefix | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
git config --local core.hooksPath .githooks | ||
git config --local core.hooksPath ./.githooks | ||
git config --local commit.template .gitmessage | ||
echo "Success!!" |