fix: remove flags automatically

This commit is contained in:
Rejman Nascimento 2024-02-23 09:58:27 -03:00
parent ffcf44621e
commit 52ef4ad669

View file

@ -27,7 +27,7 @@ remove_flags() {
local message="$1"
local flags=("${@:2}")
local regex=$(IFS="|"; echo "${flags[*]}")
local regex=$(IFS="|"; echo "${_git_commit_flags[*]}")
message=$(sed -E "s/\s($regex)\s|\s($regex)$//g" <<< "$message")
@ -38,23 +38,18 @@ build_message () {
if [[ "$*" =~ (-sa|-as) ]]; then
local attention='!'
local scope="($2)"
shift 2
elif [[ "$1" =~ (-a|--attention) ]]; then
local attention='!'
shift 1
elif [[ "$2" =~ (-a|--attention) ]]; then
local attention='!'
shift 1
elif [[ "$*" =~ (-a|--attention) ]]; then
local attention='!'
fi
if [[ "$*" =~ (-s|--scope) ]]; then
local scope="($2)"
shift 2
elif [[ "$2" =~ (-s|--scope) ]]; then
local scope="($3)"
shift 2
fi
local message="'$type'${scope}$attention: $@";