Formatting

This commit is contained in:
Eelco Dolstra 2023-03-21 14:12:15 +01:00
parent 9eb53bbf17
commit 3fc4659d22

View file

@ -48,6 +48,7 @@ rec {
${indent " " body} ${indent " " body}
''; '';
# separate body to cleanly handle indentation # separate body to cleanly handle indentation
body = '' body = ''
${description} ${description}
@ -56,6 +57,7 @@ rec {
${showAliases aliases} ${showAliases aliases}
''; '';
showDefault = documentDefault: defaultValue: showDefault = documentDefault: defaultValue:
if documentDefault then if documentDefault then
# a StringMap value type is specified as a string, but # a StringMap value type is specified as a string, but
@ -67,11 +69,14 @@ rec {
if defaultValue then "`true`" else "`false`" if defaultValue then "`true`" else "`false`"
else "`${toString defaultValue}`" else "`${toString defaultValue}`"
else "*machine-specific*"; else "*machine-specific*";
showAliases = aliases: showAliases = aliases:
if aliases == [] then "" else if aliases == [] then "" else
"**Deprecated alias:** ${(concatStringsSep ", " (map (s: "`${s}`") aliases))}"; "**Deprecated alias:** ${(concatStringsSep ", " (map (s: "`${s}`") aliases))}";
indent = prefix: s: indent = prefix: s:
concatStringsSep "\n" (map (x: if x == "" then x else "${prefix}${x}") (splitLines s)); concatStringsSep "\n" (map (x: if x == "" then x else "${prefix}${x}") (splitLines s));
in result; in result;
showSettings = useSpans: settingsInfo: concatStrings (attrValues (mapAttrs (showSetting useSpans) settingsInfo)); showSettings = useSpans: settingsInfo: concatStrings (attrValues (mapAttrs (showSetting useSpans) settingsInfo));