Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion within a function

On Fri, Jan 1, 2021 at 6:27 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Thu, Dec 31, 2020 at 1:25 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > On Wed, Dec 30, 2020 at 5:04 PM Felipe Contreras
> > <felipe.contreras@xxxxxxxxx> wrote:
> > >
> > > With that I do see the output. There's some garbage in it, but it works.
> >
> > I'm curious what the garbage is?  Maybe something needs redirection.
> Ahh ... because it's zpty, the cursor movements get captured along
> with everything else.

Yes, that's what happens.

> That's a bit of a monkey wrench unless all you want to do is display
> the result.  Hmm.

In my particular use-case I just need the list of completions in some
format. I use one per line because it's easier on my tests:

  test_completion "git checkout " <<-\EOF
  branch-in-other Z
  main Z
  main-in-other Z
  matching-branch Z
  matching-tag Z
  other/branch-in-other Z
  other/main-in-other Z

That way I can test the zsh completion system of git-completion the
same way the git project tests the bash completion (I initially wrote
the tests for that too):


Felipe Contreras

Messages sorted by: Reverse Date, Date, Thread, Author