mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-10-22 14:04:41 +08:00
feat(git-commit): use git-dash commands (#12628)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
+1
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
+1
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
+1
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
+1
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
_omz_git_commit() {
|
||||
0=${(%):-%x}
|
||||
if [[ "$0" != */git-* ]]; then
|
||||
echo >&2 "Expecting command named git-foo. Got '$0'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local _type="${0##*/git-}"
|
||||
# The subcommand is shortened to avoid Git's built-in revert command.
|
||||
if [[ "$_type" == rev ]]; then
|
||||
_type=revert
|
||||
fi
|
||||
local _scope _attention _message
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-s | --scope )
|
||||
if [ -z $2 ]; then
|
||||
echo >&2 "Missing scope!"
|
||||
return 1
|
||||
fi
|
||||
_scope="$2"
|
||||
shift 2
|
||||
;;
|
||||
-a | --attention )
|
||||
_attention="!"
|
||||
shift 1
|
||||
;;
|
||||
* )
|
||||
_message="${_message} $1"
|
||||
shift 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
|
||||
}
|
||||
_omz_git_commit "$@"
|
||||
Reference in New Issue
Block a user