lib/types: improve loaOf warning
Not all modules use name attribute as the name of the submodule, for example, environment.etc uses target. We will need to maintain a list of exceptions.
This commit is contained in:
parent
e85b34c484
commit
b0c2c96cbe
@ -340,18 +340,22 @@ rec {
|
||||
let
|
||||
padWidth = stringLength (toString (length def.value));
|
||||
unnamed = i: unnamedPrefix + fixedWidthNumber padWidth i;
|
||||
nameAttrs = {
|
||||
"environment.etc" = "target";
|
||||
};
|
||||
nameAttr = nameAttrs.${option} or "name";
|
||||
res =
|
||||
{ inherit (def) file;
|
||||
value = listToAttrs (
|
||||
imap1 (elemIdx: elem:
|
||||
{ name = elem.name or (unnamed elemIdx);
|
||||
{ name = elem.${nameAttr} or (unnamed elemIdx);
|
||||
value = elem;
|
||||
}) def.value);
|
||||
};
|
||||
option = concatStringsSep "." loc;
|
||||
sample = take 3 def.value;
|
||||
list = concatMapStrings (x: ''{ name = "${x.name or "unnamed"}"; ...} '') sample;
|
||||
set = concatMapStrings (x: ''${x.name or "unnamed"} = {...}; '') sample;
|
||||
list = concatMapStrings (x: ''{ ${nameAttr} = "${x.${nameAttr} or "unnamed"}"; ...} '') sample;
|
||||
set = concatMapStrings (x: ''${x.${nameAttr} or "unnamed"} = {...}; '') sample;
|
||||
msg = ''
|
||||
In file ${def.file}
|
||||
a list is being assigned to the option config.${option}.
|
||||
|
Loading…
Reference in New Issue
Block a user