Re: [PATCH 3/6] completion: return the index of found word from __git_find_on_cmdline()
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Dec 19, 2019, 14:44 UTC
- Message-ID
- <20191219144419.GE8609@szeder.dev>
- In-Reply-To
- <20191018143728.GC29845@szeder.dev>
On Fri, Oct 18, 2019 at 04:37:28PM +0200, SZEDER Gábor wrote:
Show 22 quoted lines
> On Thu, Oct 17, 2019 at 01:52:27PM -0400, Eric Sunshine wrote:
> > > __git_find_on_cmdline ()
> > > {
> > > - local word c=1
> > > + local word c=1 show_idx
> > > +
> > > + while test $# -gt 1; do
> > > + case "$1" in
> > > + --show-idx) show_idx=y ;;
> > > + *) return 1 ;;
> >
> > Should this emit an error message to aid a person debugging a test
> > which fails on a call to __git_find_on_cmdline()? For instance:
> >
> > echo "unrecognized option/argument: $1" >&2
> > return 1
> > ;;
> >
> > or something...
>
> When debugging the completion script I frequently resort to 'echo >&2
> "<msg>"', for lack of better options.Well, there is a better option for debugging: adding 'echo >>~/LOG "<msg>"' to the completion script and running 'tail -f ~/LOG' in a separate terminal window is so much more convenient than screwing up the command line with those messages to stderr every time.
I just wonder why it took me about a dozen years to figure this one out... ;)