D6709: config: add --registered flag to show all known configs
av6 (Anton Shestakov)
phabricator at mercurial-scm.org
Tue Sep 17 04:58:15 EDT 2019
av6 added a comment.
In D6709#100618 <https://phab.mercurial-scm.org/D6709#100618>, @marmoute wrote:
> In D6709#99199 <https://phab.mercurial-scm.org/D6709#99199>, @av6 wrote:
>> I'm strongly -1 on adding qualifiers straight to the keys. The primary usage scenario here is scripts (as explained in issue6014) -- regular users lived without this feature for years and didn't care (enough to file a bug) about getting all config options, or their default values, //or// the experimental status (they could and still can read it in hg help config). `--registered` is needed for things like shell completions, and the output needs to be clear and parseable (and consistent with what regular showconfig shows).
> I disagree that the primary use is script only. As a suer I have wanted this for a long time and I am happy to finally have a way to get this data without grepping the source.
Oh, now I see what you wanted from this patch. But you want it as a developer who works with and on hg, not just as a user (hopefully regular users don't have to grep the source). This distinction makes things easier to design, because we now have simply two (plus one) cases:
- `--registered` will simply extend the list of config options to walk from options found somewhere in system/user/repo config files to every config option ever registered (excluding experimental/devel/debug ones unless `-v` is given//*//)
- existing `--debug` mode of showconfig will show the `(EXPERIMENTAL)` and `(default: x)` information in addition to what it shows now and can be used with `--registered` (and registered but unset options can have "<registered>" source, similar to the existing "<tweakdefaults>" source)
- anyone can still use `-T` to access key, value, defaultvalue, source and status in whatever format they want, and `--registered` will work as expected from its name (i.e. just iterating over a different set of config options)
//*// This is still not great, because if you set an experimental config option and run showconfig with no flags, it will be in the output. With `--registered` as it is implemented right now it won't be shown without `-v`. We should either show any options when they are set regardless of what status they have, or not require `-v` at all.
Making one flag do one thing is good UI. That's why I want `--registered` alone to not modify any output of showconfig. Doing only one thing is also easier for help text to explain and for users to understand (even without reading help text, just based on the name of the flag).
And to make the review process easier, I propose doing this in 3 or 4 patches:
- adding `--registered`: will simply show all registered options in key=value format
- adding defaults and experimental/devel/debug statuses to `showconfig --debug` output (this one can be split into two)
- showing config options in a human-friendly format
CHANGES SINCE LAST ACTION
To: navaneeth.suresh, #hg-reviewers, av6, marmoute, durin42
Cc: durin42, mharbison72, yuja, pulkit, marmoute, av6, mjpieters, mercurial-devel
More information about the Mercurial-devel