refactor(template.sh): some refactoring

This commit is contained in:
Ghasem Shirdel 2022-01-24 11:43:05 +03:30 committed by GitHub
parent 30a451b213
commit 80ec398a5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,10 @@
# Color formatting
RED="\033[0;31m"
GREEN="\033[0;32m"
BLUE="\033[1;34m"
CYAN="\033[0;36m"
RESET="\033[0m"
git_commit_template() {
# Check the current folder is a git repository
@ -6,13 +13,6 @@ git_commit_template() {
exit 1
fi
# Color formatting
RED="\033[0;31m"
GREEN="\033[0;32m"
BLUE="\033[1;34m"
CYAN="\033[0;36m"
RESET="\033[0m"
# Valid types
TYPES=("feat" "fix" "docs" "style" "refactor"
"pref" "test" "build" "ci" "chore" "revert")
@ -118,11 +118,11 @@ octo-org/octo-repo#100\n\n"
fi
if [ ! -z "$breaking_changes" ]; then
massage="${massage} BREAKING CHANGE: ${breaking_changes}\n"
massage="${massage}\n BREAKING CHANGE: ${breaking_changes}\n"
fi
if [ ! -z "$closed_issues" ]; then
massage="${massage} ${closed_issues}\n"
massage="${massage}\n ${closed_issues}\n"
fi
printf "${massage}\n${RESET}"
@ -133,13 +133,17 @@ octo-org/octo-repo#100\n\n"
git commit -S -m "${type_var}${scope}: ${short_desc}
${long_desc}
${breaking_changes}
${closed_issues}"
else
git commit -m "${type_var}${scope}: ${short_desc}
${long_desc}
${breaking_changes}
${closed_issues}"
fi
else