From 09eb7f1ef653822616e7371c906ef1ae34b3ba09 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Wed, 6 Sep 2023 09:30:32 +0200 Subject: [PATCH] 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. --- doc/manual/generate-manpage.nix | 4 ++++ src/libutil/args.cc | 1 + 2 files changed, 5 insertions(+) diff --git a/doc/manual/generate-manpage.nix b/doc/manual/generate-manpage.nix index 705fc0b69..87891fa7a 100644 --- a/doc/manual/generate-manpage.nix +++ b/doc/manual/generate-manpage.nix @@ -79,6 +79,10 @@ let # Options ${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: diff --git a/src/libutil/args.cc b/src/libutil/args.cc index 00281ce6f..8db293762 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -236,6 +236,7 @@ nlohmann::json Args::toJSON() for (auto & [name, flag] : longFlags) { auto j = nlohmann::json::object(); + if (hiddenCategories.count(flag->category)) continue; if (flag->aliases.count(name)) continue; if (flag->shortName) j["shortName"] = std::string(1, flag->shortName);