1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 18:01:16 +02:00

nix store --help: Include store type documentation

This commit is contained in:
Eelco Dolstra 2023-03-21 12:58:14 +01:00
parent cdfa59daa1
commit 8d6d59cb1b
9 changed files with 102 additions and 60 deletions

View file

@ -1,4 +1,4 @@
{ toplevel }:
cliDumpStr:
with builtins;
with import ./utils.nix;
@ -63,7 +63,10 @@ let
* [`${command} ${name}`](./${appendName filename name}.md) - ${subcmd.description}
'';
maybeDocumentation = if details ? doc then details.doc else "";
maybeDocumentation =
if details ? doc
then replaceStrings ["@stores@"] [storeDocs] details.doc
else "";
maybeOptions = if details.flags == {} then "" else ''
# Options
@ -110,13 +113,13 @@ let
};
in [ cmd ] ++ concatMap subcommand (attrNames details.commands or {});
parsedToplevel = builtins.fromJSON toplevel;
cliDump = builtins.fromJSON cliDumpStr;
manpages = processCommand {
command = "nix";
details = parsedToplevel;
details = cliDump.args;
filename = "nix";
toplevel = parsedToplevel;
toplevel = cliDump.args;
};
tableOfContents = let
@ -124,4 +127,14 @@ let
" - [${page.command}](command-ref/new-cli/${page.name})";
in concatStringsSep "\n" (map showEntry manpages) + "\n";
storeDocs =
let
showStore = name: { settings }:
''
## ${name}
${showSettings false settings}
'';
in concatStrings (attrValues (mapAttrs showStore cliDump.stores));
in (listToAttrs manpages) // { "SUMMARY.md" = tableOfContents; }