diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index bfa6d33..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "etc/gitignore"] - path = etc/gitignore - url = git://github.com/github/gitignore.git diff --git a/Makefile b/Makefile index d41fa3d..4a94be1 100644 --- a/Makefile +++ b/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 diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh new file mode 100644 index 0000000..273c680 --- /dev/null +++ b/etc/bash_completion.sh @@ -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" +}