Re: [RFC PATCH] bash completion: complete refs for git-grep
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Oct 6, 2009, 15:45 UTC
- Message-ID
- <20091006154555.GN9261@spearce.org>
- In-Reply-To
- <14ac499280c9b17f862ab13201b48c64b4827713.1254823328.git.trast@student.ethz.ch>
Thomas Rast <trast@student.ethz.ch> wrote:
> This is still RFC because, as you can see in the code below, I tried > to avoid completing at all while the user still needs to supply a > regex. Sadly, bash turns the COMPREPLY=() into filename completion > anyway. Is there a way to prevent this?
Not that I know of. You can turn off default filename completion when you register the completion function, but that then breaks like every other git command for completion support because a lot of them do want to complete filenames.
Show 11 quoted lines
> + local i c=1 have_regex=""
> + while [ $c -lt $COMP_CWORD ]; do
> + i="${COMP_WORDS[c]}"
> + case "$i" in
> + -e) ;;
> + -e*) have_regex="$c" ; break ;;
> + -*) ;;
> + *) have_regex="$c"; break ;;
> + esac
> + c=$((++c))
> + doneWhat happens with `git grep -e a -e b`? Do we trigger into ref completion too early when we should still be doing the regex completion?
-- Shawn.