Add git-auto-status zsh plugin
This commit is contained in:
parent
fc19792d21
commit
a367e40cf3
2 changed files with 32 additions and 0 deletions
|
@ -85,6 +85,7 @@ plugins=(
|
||||||
encode64
|
encode64
|
||||||
extract
|
extract
|
||||||
git
|
git
|
||||||
|
git-auto-status
|
||||||
jump
|
jump
|
||||||
kubectl
|
kubectl
|
||||||
safe-paste
|
safe-paste
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#
|
||||||
|
# Run git status after specified set of command
|
||||||
|
#
|
||||||
|
# @author Oleksandr Shybystyi oleksandr.shybystyi@gmail.com
|
||||||
|
#
|
||||||
|
|
||||||
|
# default list of git commands `git status` is running after
|
||||||
|
gitPreAutoStatusCommands=(
|
||||||
|
'add'
|
||||||
|
'rm'
|
||||||
|
'reset'
|
||||||
|
'commit'
|
||||||
|
'checkout'
|
||||||
|
'mv'
|
||||||
|
'init'
|
||||||
|
)
|
||||||
|
|
||||||
|
# taken from http://stackoverflow.com/a/8574392/4647743
|
||||||
|
function elementInArray() {
|
||||||
|
local e
|
||||||
|
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function git() {
|
||||||
|
command git $@
|
||||||
|
|
||||||
|
if (elementInArray $1 $gitPreAutoStatusCommands); then
|
||||||
|
command git status
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in a new issue