mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Merge pull request #64 from jweslley/feature/bash_completion
bash completion support
This commit is contained in:
commit
8ff4ec94e7
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,3 +0,0 @@
|
|||
[submodule "etc/gitignore"]
|
||||
path = etc/gitignore
|
||||
url = git://github.com/github/gitignore.git
|
||||
2
Makefile
2
Makefile
|
|
@ -16,6 +16,7 @@ install:
|
|||
cp -f $(BIN) $(PREFIX)/$(BIN); \
|
||||
)
|
||||
cp -f man/git-*.1 $(MANPREFIX)
|
||||
cp -f etc/bash_completion.sh /etc/bash_completion.d/git-extras
|
||||
|
||||
docs: $(MAN_HTML) $(MAN_PAGES)
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ uninstall:
|
|||
echo "... uninstalling $(MANPREFIX)/$(MAN)"; \
|
||||
rm -f $(MANPREFIX)/$(MAN); \
|
||||
)
|
||||
rm -f /etc/bash_completion.d/git-extras
|
||||
|
||||
clean: docclean
|
||||
|
||||
|
|
|
|||
49
etc/bash_completion.sh
Normal file
49
etc/bash_completion.sh
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# bash completion support for git-extras.
|
||||
|
||||
_git_changelog(){
|
||||
__gitcomp "--list"
|
||||
}
|
||||
|
||||
_git_contrib(){
|
||||
__gitcomp "$(git shortlog -s | cut -f2)" # TODO buggy if author's name contains whitespaces :(
|
||||
}
|
||||
|
||||
_git_count(){
|
||||
__gitcomp "--all"
|
||||
}
|
||||
|
||||
_git_delete_branch(){
|
||||
__gitcomp "$(__git_heads)"
|
||||
}
|
||||
|
||||
_git_delete_submodule(){
|
||||
__gitcomp "$(git submodule status | awk '{print $2}')"
|
||||
}
|
||||
|
||||
_git_delete_tag(){
|
||||
__gitcomp "$(__git_tags)"
|
||||
}
|
||||
|
||||
_git_extras(){
|
||||
__gitcomp "--version update"
|
||||
}
|
||||
|
||||
_git_graft(){
|
||||
__gitcomp "$(__git_heads)"
|
||||
}
|
||||
|
||||
__git_extras_workflow(){
|
||||
__gitcomp "$(__git_heads | grep ^$1/ | sed s/^$1\\///g) finish"
|
||||
}
|
||||
|
||||
_git_feature(){
|
||||
__git_extras_workflow "feature"
|
||||
}
|
||||
|
||||
_git_refactor(){
|
||||
__git_extras_workflow "refactor"
|
||||
}
|
||||
|
||||
_git_bug(){
|
||||
__git_extras_workflow "bug"
|
||||
}
|
||||
Loading…
Reference in a new issue