Re: [PATCH] advice: refactor advise API
From: Jeff King <hidden>
Date: 2020-02-11 19:52:02
On Tue, Feb 11, 2020 at 02:49:43PM -0500, Jeff King wrote:
On Mon, Feb 10, 2020 at 02:55:28PM -0800, Emily Shaffer wrote:quoted
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