do not show configuration override flags for each command

this removes a lot of noise from the web search, which precludes finding
the actual documentation.

some configuration settings have enough documentation to warrant
individual pages, so the alternative of including full setting
documentation in each command page doesn't make much sense here.

this change technically means that the command line flags to override
settings are "invisible", and not exported as JSON. this may or may not
be desirable. a more explicit approach would be adding a `hidden` field
to the flag's JSON output, but would also require adjusting
post-processing of that JSON for manual rendering.
This commit is contained in:
Valentin Gagarin 2023-09-06 09:30:32 +02:00
parent b0fe7f560d
commit 09eb7f1ef6
2 changed files with 5 additions and 0 deletions

View file

@ -79,6 +79,10 @@ let
# Options # Options
${showOptions details.flags toplevel.flags} ${showOptions details.flags toplevel.flags}
> **Note**
>
> See [`man nix.conf`](@docroot@/command-ref/conf-file.md#command-line-flags) for overriding configuration settings with command line flags.
''; '';
showOptions = options: commonOptions: showOptions = options: commonOptions:

View file

@ -236,6 +236,7 @@ nlohmann::json Args::toJSON()
for (auto & [name, flag] : longFlags) { for (auto & [name, flag] : longFlags) {
auto j = nlohmann::json::object(); auto j = nlohmann::json::object();
if (hiddenCategories.count(flag->category)) continue;
if (flag->aliases.count(name)) continue; if (flag->aliases.count(name)) continue;
if (flag->shortName) if (flag->shortName)
j["shortName"] = std::string(1, flag->shortName); j["shortName"] = std::string(1, flag->shortName);