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