Make useAnchors a named argument

This commit is contained in:
Eelco Dolstra 2023-03-23 10:08:49 +01:00
parent 80f0b8d307
commit 2851e239a7
3 changed files with 4 additions and 4 deletions

View file

@ -137,7 +137,7 @@ let
**Settings**:
${showSettings false settings}
${showSettings { useAnchors = false; } settings}
'';
in concatStrings (attrValues (mapAttrs showStore cliDump.stores));

View file

@ -66,7 +66,7 @@ $(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/generate-manpage.nix $(bindir)/
$(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/utils.nix $(d)/src/command-ref/conf-file-prefix.md $(bindir)/nix
@cat doc/manual/src/command-ref/conf-file-prefix.md > $@.tmp
$(trace-gen) $(nix-eval) --expr '(import doc/manual/utils.nix).showSettings true (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp;
$(trace-gen) $(nix-eval) --expr '(import doc/manual/utils.nix).showSettings { useAnchors = true; } (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp;
@mv $@.tmp $@
$(d)/nix.json: $(bindir)/nix

View file

@ -39,7 +39,7 @@ rec {
filterAttrs = pred: set:
listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
showSetting = useAnchors: name: { description, documentDefault, defaultValue, aliases, ... }:
showSetting = { useAnchors }: name: { description, documentDefault, defaultValue, aliases, ... }:
let
result = squash ''
- ${if useAnchors
@ -79,5 +79,5 @@ rec {
in result;
showSettings = useAnchors: settingsInfo: concatStrings (attrValues (mapAttrs (showSetting useAnchors) settingsInfo));
showSettings = args: settingsInfo: concatStrings (attrValues (mapAttrs (showSetting args) settingsInfo));
}