summaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-02-04 07:38:23 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-02-04 08:18:41 (GMT)
commit8435b548480a6b6d110fd2f59b3139f25ffb392e (patch)
tree6374ff2cec4aa73441ff0da86899158c6d25da1b /contrib/completion/git-completion.bash
parent2e3a430a9a976ec9324b33fef41dfeb55353a1ae (diff)
downloadgit-8435b548480a6b6d110fd2f59b3139f25ffb392e.zip
git-8435b548480a6b6d110fd2f59b3139f25ffb392e.tar.gz
git-8435b548480a6b6d110fd2f59b3139f25ffb392e.tar.bz2
bash: Complete long options to git-add.
The new --interactive mode of git-add can be very useful, so users will probably want to have completion for it. Likewise the new git-add--interactive executable is actually a plumbing command. Its invoked by `git add --interactive` and is not intended to be invoked directly by the user. Therefore we should hide it from the list of available Git commands. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rwxr-xr-xcontrib/completion/git-completion.bash16
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b87f96d..93f2af5 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -235,6 +235,7 @@ __git_commands ()
for i in $(git help -a|egrep '^ ')
do
case $i in
+ add--interactive) : plumbing;;
cat-file) : plumbing;;
check-ref-format) : plumbing;;
commit-tree) : plumbing;;
@@ -358,6 +359,19 @@ _git_apply ()
COMPREPLY=()
}
+_git_add ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ COMPREPLY=($(compgen -W "
+ --interactive
+ " -- "$cur"))
+ return
+ esac
+ COMPREPLY=()
+}
+
_git_branch ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -786,6 +800,7 @@ _git ()
case "$command" in
am) _git_am ;;
+ add) _git_add ;;
apply) _git_apply ;;
branch) _git_branch ;;
checkout) _git_checkout ;;
@@ -852,6 +867,7 @@ complete -o default -o nospace -F _git_log git-whatchanged
# included the '.exe' suffix.
#
if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
+complete -o default -F _git_add git-add.exe
complete -o default -F _git_apply git-apply.exe
complete -o default -o nospace -F _git git.exe
complete -o default -F _git_branch git-branch.exe