From: "Shawn O. Pearce" <spearce@spearce•org>
To: Lee Marlow <lee.marlow@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] bash completion: Add completion for 'git grep'
Date: Sat, 2 Aug 2008 14:05:25 -0700 [thread overview]
Message-ID: <20080802210525.GD24723@spearce.org> (raw)
In-Reply-To: <1217638593-57321-1-git-send-email-lee.marlow@gmail.com>
Lee Marlow <lee.marlow@gmail•com> 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.
next prev parent reply other threads:[~2008-08-02 21:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-02 0:56 [PATCH] bash completion: Add completion for 'git grep' Lee Marlow
2008-08-02 21:05 ` Shawn O. Pearce [this message]
2008-08-03 7:31 ` Lee Marlow
2008-08-04 4:06 ` Shawn O. Pearce
2008-08-04 5:26 ` Lee Marlow
2008-08-04 14:52 ` Shawn O. Pearce
2008-08-04 14:53 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080802210525.GD24723@spearce.org \
--to=spearce@spearce$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=lee.marlow@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox