mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
style: formatting
This commit is contained in:
parent
e1f45d5fa7
commit
25a980ef46
1 changed files with 12 additions and 10 deletions
|
|
@ -24,21 +24,23 @@ _git_commit_flags=(
|
||||||
)
|
)
|
||||||
|
|
||||||
remove_flags() {
|
remove_flags() {
|
||||||
local regex=$(IFS="|"; echo "${_git_commit_flags[*]}")
|
local regex=$(
|
||||||
|
IFS="|"
|
||||||
|
echo "${_git_commit_flags[*]}"
|
||||||
|
)
|
||||||
|
|
||||||
echo $(sed -E "s/\s($regex)\s|\s($regex)$//g" <<< "$1")
|
echo $(sed -E "s/\s($regex)\s|\s($regex)$//g" <<<"$1")
|
||||||
};
|
}
|
||||||
|
|
||||||
build_message () {
|
build_message() {
|
||||||
local argv=("$@")
|
local argv=("$@")
|
||||||
local argc=${#@}
|
local argc=${#@}
|
||||||
local i=1
|
local i=1
|
||||||
|
|
||||||
while [[ $i -lt $argc ]];
|
while [[ $i -lt $argc ]]; do
|
||||||
do
|
|
||||||
local flag="${argv[$i]}"
|
local flag="${argv[$i]}"
|
||||||
local value="${argv[$i + 1]}"
|
local value="${argv[$i + 1]}"
|
||||||
local next=$[$i + 1]
|
local next=$(($i + 1))
|
||||||
|
|
||||||
if [[ "$flag" =~ (-sa|-as) ]]; then
|
if [[ "$flag" =~ (-sa|-as) ]]; then
|
||||||
local attention='!'
|
local attention='!'
|
||||||
|
|
@ -55,14 +57,14 @@ build_message () {
|
||||||
local scope="($value)"
|
local scope="($value)"
|
||||||
i=$next
|
i=$next
|
||||||
fi
|
fi
|
||||||
i=$next
|
i=$next
|
||||||
done
|
done
|
||||||
|
|
||||||
local template="'$type'${scope}$attention: ${@}";
|
local template="'$type'${scope}$attention: ${@}"
|
||||||
local message=$(remove_flags "$template" "${_git_commit_flags[@]}")
|
local message=$(remove_flags "$template" "${_git_commit_flags[@]}")
|
||||||
|
|
||||||
git commit -m "$message"
|
git commit -m "$message"
|
||||||
};
|
}
|
||||||
|
|
||||||
local alias type
|
local alias type
|
||||||
for type in "${_git_commit_aliases[@]}"; do
|
for type in "${_git_commit_aliases[@]}"; do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue