feat(git-commit): support optional commit body (#14169)

This commit is contained in:
Federico Tensi authored and GitHub committed 2026-11-26 07:28:56 -08:00
1 parent b1d468701a
commit e333686c2a
2 files changed
+17 -5

No files matched your search

+11 -3
View File
@@ -12,11 +12,11 @@ _omz_git_commit() {
if [[ "$_type" == rev ]]; then
_type=revert
fi
local _scope _attention _message
local _scope _attention _message _body
while [ $# -ne 0 ]; do
case $1 in
-s | --scope )
if [ -z $2 ]; then
if [ -z "$2" ]; then
echo >&2 "Missing scope!"
return 1
fi
@@ -27,12 +27,20 @@ _omz_git_commit() {
_attention="!"
shift 1
;;
-b | --body )
if [ -z "$2" ]; then
echo >&2 "Missing body!"
return 1
fi
_body="$2"
shift 2
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}" ${_body:+-m} ${_body:+"$_body"}
}
_omz_git_commit "$@"