[PATCH 2/10] Hide plumbing/transport commands from bash completion.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Users generally are not going to need to invoke plumbing-level commands
from within one line shell commands.  If they are invoking these commands
then it is likely that they are glueing them together into a shell script
to perform an action, in which case bash completion for these commands is
of relatively little use.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 contrib/completion/git-completion.bash |   62 +++++++++++++++++++++++++++++---
 1 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 28bd0e3..b55431f 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -125,6 +125,58 @@ __git_complete_file ()
 	esac
 }
 
+__git_commands ()
+{
+	local i IFS=" "$'\n'
+	for i in $(git help -a|egrep '^ ')
+	do
+		case $i in
+		check-ref-format) : plumbing;;
+		commit-tree)      : plumbing;;
+		convert-objects)  : plumbing;;
+		cvsserver)        : daemon;;
+		daemon)           : daemon;;
+		fetch-pack)       : plumbing;;
+		hash-object)      : plumbing;;
+		http-*)           : transport;;
+		index-pack)       : plumbing;;
+		local-fetch)      : plumbing;;
+		mailinfo)         : plumbing;;
+		mailsplit)        : plumbing;;
+		merge-*)          : plumbing;;
+		mktree)           : plumbing;;
+		mktag)            : plumbing;;
+		pack-objects)     : plumbing;;
+		pack-redundant)   : plumbing;;
+		pack-refs)        : plumbing;;
+		parse-remote)     : plumbing;;
+		patch-id)         : plumbing;;
+		peek-remote)      : plumbing;;
+		read-tree)        : plumbing;;
+		receive-pack)     : plumbing;;
+		rerere)           : plumbing;;
+		rev-list)         : plumbing;;
+		rev-parse)        : plumbing;;
+		runstatus)        : plumbing;;
+		sh-setup)         : internal;;
+		shell)            : daemon;;
+		send-pack)        : plumbing;;
+		show-index)       : plumbing;;
+		ssh-*)            : transport;;
+		stripspace)       : plumbing;;
+		symbolic-ref)     : plumbing;;
+		unpack-file)      : plumbing;;
+		unpack-objects)   : plumbing;;
+		update-ref)       : plumbing;;
+		update-server-info) : daemon;;
+		upload-archive)   : plumbing;;
+		upload-pack)      : plumbing;;
+		write-tree)       : plumbing;;
+		*) echo $i;;
+		esac
+	done
+}
+
 __git_aliases ()
 {
 	local i IFS=$'\n'
@@ -355,11 +407,11 @@ _git ()
 	done
 
 	if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
-		COMPREPLY=($(compgen \
-			-W "--git-dir= --version \
-				$(git help -a|egrep '^ ') \
-			    $(__git_aliases)" \
-			-- "${COMP_WORDS[COMP_CWORD]}"))
+		COMPREPLY=($(compgen -W "
+			--git-dir= --version --exec-path
+			$(__git_commands)
+			$(__git_aliases)
+			" -- "${COMP_WORDS[COMP_CWORD]}"))
 		return;
 	fi
 
-- 
1.4.4.1.ge3fb

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]