ohmyzsh/plugins/git-commit/git-commit.plugin.zsh
2023-09-06 10:54:13 +02:00

27 lines
563 B
Bash

function _git_commit_register {
if ! git config --global --get-all alias.$1 >/dev/null 2>&1; then
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
}
local -a _git_commit_aliases
_git_commit_aliases=(
'build'
'chore'
'ci'
'docs'
'feat'
'fix'
'perf'
'refactor'
'revert'
'style'
'test'
)
for _alias in "${_git_commit_aliases[@]}"; do
_git_commit_register $_alias
done
unfunction _git_commit_register
unset _alias