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

Re: [PATCH] Remove redundancies from `git` completion



Marlon Richert wrote on Tue, Aug 31, 2021 at 08:52:02 +0300:
> On Mon, Aug 30, 2021 at 3:42 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> >
> > On 8/30/21, Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> > > On Mon, Aug 30, 2021 at 2:41 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> > >>
> > >> On 8/30/21, Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> > >> > By the way: Why is there a `(( $+functions[_git-XXX] )) ||` statement
> > >> > in front of each function inside Completion/Unix/Command/_git ? Can
> > >> > those be removed?
> > >>
> > >> They are there so that you can override their implementation easily.
> > >
> > > Is that documented somewhere?
> >
> > Not explicitly, afaik.
> 
> I see this pattern is used in several completer functions.Should it be
> documented?

Maybe.

If we document it, that means we'll have to also document compatibility
promises for those functions, because people can't be expected to
upgrade their dotfiles and fpath's in lockstep (e.g., on shared
machines).

I don't think we generally treat those functions as stable API's.
Therefore, it might be better to deprecate the practice of making them
overridable in this way.

Anyone who wants to override them will still be able to do «autoload +X
_git && _git && _git-foo() { … }» (or a better solution which someone
will probably post in reply to this one).

> >
> > > And for purposes of overriding, wouldn't it be cleaner to simply
> > > supply all sub-functions as separate #autoload files?
> >
> > I don't think anyone is interested in maintaining 285 separate
> > completer files for git :).
> 
> If you count the #autoload line,

We don't count lines.




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