Re: [PATCH] advice: refactor advise API
- From
Jeff King <peff@peff.net>
- Date
- Feb 11, 2020, 19:51 UTC
- Message-ID
- <20200211195159.GD2127797@coredump.intra.peff.net>
- In-Reply-To
- <20200211194943.GC2127797@coredump.intra.peff.net>
On Tue, Feb 11, 2020 at 02:49:43PM -0500, Jeff King wrote:
Show 9 quoted lines
> On Mon, Feb 10, 2020 at 02:55:28PM -0800, Emily Shaffer wrote: > > > I tend to disagree on both counts. I'd personally rather see something > > like 'void advise_key(enum advice, char *format, ...)'. > > Yeah, I don't mind that at all. It's mutually exclusive with not making > people add new enums when they want to add new advice types, but as you > note we do get some code maintenance benefit by having the variables, > even if _adding_ a new one is a slightly larger pain.
Thinking on it a bit more, one argument in favor of having enums or variables or whatever is that we _do_ need a master list of all of the variables in one spot: the documentation.
So one direction we _could_ go is either generating the enum from the documentation or vice versa (or generating both from a master list). That would give us one place to define a new key along with its description.
-Peff