Re: [PATCH] bash completion: Add completion for 'git grep'

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

 



Lee Marlow <lee.marlow@xxxxxxxxx> wrote:
> +_git_grep ()
> +{
> +	__git_has_doubledash && return
> +
> +	local cur="${COMP_WORDS[COMP_CWORD]}"
> +	case "$cur" in
> +	--*)
> +		__gitcomp "
> +			--cached
> +			--text --ignore-case --word-regexp --invert-match
> +			--full-name
> +			--extended-regexp --basic-regexp --fixed-strings
> +			--files-with-matches --name-only
> +			--files-without-match
> +			--count
> +			--and --or --not --all-match
> +			"
> +		return
> +		;;
> +	esac
> +	COMPREPLY=()
> +}


Hmm.  The has_doubledash test seems redundant since we don't do
anything with args that aren't --foo.  Even though git-grep will
accept a tree-ish and thus completion of __git_refs here may
make sense.

I wonder if we shouldn't just add to the end something like:

	__gitcomp "$(__git_refs)"

like the _git_reset function does.  Then we can complete a tree-ish
for searching, as well as honor -- to stop tree-ish completion and
go back to file/directory completion.

But that is very much a user question.  Do users mostly search a
file in the current working directory, or do they mostly search
a tree-ish?

-- 
Shawn.
--
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]

  Powered by Linux