Added new plugin git-auto-status to automatically run git status command after bunch of commands like git commit

This commit is contained in:
Oleksandr Shybystyi 2015-05-15 23:27:13 +03:00
commit aaadaff470
2 changed files with 55 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# Git auto status
If you found yourself constantly typing `git status` after bunch of commands like
`git commit` and you want to avoid that, than this plugin is for you.
### Tuning
The default list of command that git status is automatically running after is
next:
```bash
gitPreAutoStatusCommands=(
'add'
'rm'
'reset'
'commit'
'checkout'
)
```
You can adjust this list by setting this var in your **.zshrc** after
`plugins=(...)` initialization.
### Maintainers
[@oshybystyi](https://github.com/oshybystyi/)

View file

@ -0,0 +1,29 @@
#
# 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'
)
# 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
}