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

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



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?

>
> > 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, it would be the exact same number of
lines of code, but you wouldn't need to duplicate the function name
for each function in an `if` statement. That would be taken care of
automatically by `autoload`.




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