From 2f5a6c13997218d8af2a18176f80658ad284ac09 Mon Sep 17 00:00:00 2001 From: spacewander Date: Sun, 14 Dec 2014 15:05:39 +0800 Subject: [PATCH] add more bash completion functions --- etc/bash_completion.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index de6f7b3..342c4d5 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -9,7 +9,15 @@ _git_changelog(){ } _git_contrib(){ - __gitcomp "$(git shortlog -s | cut -f2)" # TODO buggy if author's name contains whitespaces :( +# git completion function modified from +# https://github.com/markgandolfo/git-bash-completion/blob/master/git-completion.bash + contributors="$(git shortlog -s | cut -f2)" + local all c s=$'\n' IFS=$'\n' + local cur="${COMP_WORDS[COMP_CWORD]}" + for c in $contributors; do + all="$all$c $s" + done + COMPREPLY=($(compgen -W "$all" -- "$cur")) } _git_count(){ @@ -28,6 +36,10 @@ _git_delete_tag(){ __gitcomp "$(__git_tags)" } +_git_effort(){ + __gitcomp "--above" +} + _git_extras(){ __gitcomp "--version update" }