mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-07 07:50:40 +01:00
feat(git-commit): Use git-dash commands
Issue: ohmyzsh/ohmyzsh#12627 This commit refactors the prior implementation which used git aliases and modified .gitconfig. This implementation uses proper git-dash commands, which are all just symlinks to one handler - omz_git_commit.
This commit is contained in:
1
plugins/git-commit/git-commands/git-build
Symbolic link
1
plugins/git-commit/git-commands/git-build
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-chore
Symbolic link
1
plugins/git-commit/git-commands/git-chore
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-ci
Symbolic link
1
plugins/git-commit/git-commands/git-ci
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-docs
Symbolic link
1
plugins/git-commit/git-commands/git-docs
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-feat
Symbolic link
1
plugins/git-commit/git-commands/git-feat
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-fix
Symbolic link
1
plugins/git-commit/git-commands/git-fix
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-perf
Symbolic link
1
plugins/git-commit/git-commands/git-perf
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-refactor
Symbolic link
1
plugins/git-commit/git-commands/git-refactor
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-rev
Symbolic link
1
plugins/git-commit/git-commands/git-rev
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-style
Symbolic link
1
plugins/git-commit/git-commands/git-style
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-test
Symbolic link
1
plugins/git-commit/git-commands/git-test
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
1
plugins/git-commit/git-commands/git-wip
Symbolic link
1
plugins/git-commit/git-commands/git-wip
Symbolic link
@@ -0,0 +1 @@
|
||||
./omz_git_commit
|
||||
34
plugins/git-commit/git-commands/omz_git_commit
Executable file
34
plugins/git-commit/git-commands/omz_git_commit
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/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-}"
|
||||
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