lib/generators.toPretty: Only quote attribute names if necessary
This commit is contained in:
parent
f3bf0f173e
commit
0f6231702f
|
@ -227,7 +227,7 @@ rec {
|
||||||
else "{ "
|
else "{ "
|
||||||
+ libStr.concatStringsSep " " (libAttr.mapAttrsToList
|
+ libStr.concatStringsSep " " (libAttr.mapAttrsToList
|
||||||
(name: value:
|
(name: value:
|
||||||
"${toPretty args name} = ${toPretty args value};") v)
|
"${libStr.escapeNixIdentifier name} = ${toPretty args value};") v)
|
||||||
+ " }"
|
+ " }"
|
||||||
else if isFunction v then
|
else if isFunction v then
|
||||||
let fna = lib.functionArgs v;
|
let fna = lib.functionArgs v;
|
||||||
|
|
|
@ -469,7 +469,7 @@ runTests {
|
||||||
function = "<λ>";
|
function = "<λ>";
|
||||||
functionArgs = "<λ:{(arg),foo}>";
|
functionArgs = "<λ:{(arg),foo}>";
|
||||||
list = "[ 3 4 ${function} [ false ] ]";
|
list = "[ 3 4 ${function} [ false ] ]";
|
||||||
attrs = "{ \"foo\" = null; \"foo bar\" = \"baz\"; }";
|
attrs = "{ foo = null; \"foo bar\" = \"baz\"; }";
|
||||||
drv = "<δ:test>";
|
drv = "<δ:test>";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue