2023-09-06 08:54:11 +00:00
|
|
|
function _git_commit_register {
|
|
|
|
if ! git config --global --get-all alias.$1 >/dev/null 2>&1; then
|
2023-09-10 07:28:33 +00:00
|
|
|
git config --global alias.$1 '!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$1'(${scope}): ${@}"; else git commit -m "'$1': ${@}"; fi }; a'
|
2023-09-04 17:21:27 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-09-06 08:54:11 +00:00
|
|
|
local -a _git_commit_aliases
|
|
|
|
_git_commit_aliases=(
|
2023-09-04 17:21:27 +00:00
|
|
|
'build'
|
|
|
|
'chore'
|
|
|
|
'ci'
|
|
|
|
'docs'
|
|
|
|
'feat'
|
|
|
|
'fix'
|
|
|
|
'perf'
|
|
|
|
'refactor'
|
|
|
|
'revert'
|
|
|
|
'style'
|
|
|
|
'test'
|
|
|
|
)
|
|
|
|
|
2023-09-06 08:54:11 +00:00
|
|
|
for _alias in "${_git_commit_aliases[@]}"; do
|
|
|
|
_git_commit_register $_alias
|
|
|
|
done
|
|
|
|
|
|
|
|
unfunction _git_commit_register
|
|
|
|
unset _alias
|