lib/generators/toKeyValue: add indent
parameter
toKeyValue is generic enough that it is sometimes used as part of other format generators, where it might be useful to specify the indentation level.
This commit is contained in:
parent
4b7ad2c7ea
commit
383fa81e6f
@ -81,9 +81,10 @@ rec {
|
||||
*/
|
||||
toKeyValue = {
|
||||
mkKeyValue ? mkKeyValueDefault {} "=",
|
||||
listsAsDuplicateKeys ? false
|
||||
listsAsDuplicateKeys ? false,
|
||||
indent ? ""
|
||||
}:
|
||||
let mkLine = k: v: mkKeyValue k v + "\n";
|
||||
let mkLine = k: v: indent + mkKeyValue k v + "\n";
|
||||
mkLines = if listsAsDuplicateKeys
|
||||
then k: v: map (mkLine k) (if lib.isList v then v else [v])
|
||||
else k: v: [ (mkLine k v) ];
|
||||
|
Loading…
Reference in New Issue
Block a user