optionAttrSetToDocList: Re-implement with the collect function.
Use the option name computed by "handleOptionSets" instead of computing it a second time. Handle option containing option sets. svn path=/nixpkgs/trunk/; revision=15937
This commit is contained in:
parent
0f6a67814a
commit
8f8971144f
@ -490,20 +490,31 @@ rec {
|
|||||||
fixOptionSets = merge: pkgs: opts:
|
fixOptionSets = merge: pkgs: opts:
|
||||||
lib.fix (fixOptionSetsFun merge pkgs opts);
|
lib.fix (fixOptionSetsFun merge pkgs opts);
|
||||||
|
|
||||||
optionAttrSetToDocList = l: attrs:
|
|
||||||
if (attrByPath ["_type"] "" attrs) == "option" then
|
# Generate documentation template from the list of option declaration like
|
||||||
[({
|
# the set generated with filterOptionSets.
|
||||||
#inherit (attrs) description;
|
optionAttrSetToDocList = ignore: newOptionAttrSetToDocList;
|
||||||
description = if attrs ? description then attrs.description else
|
newOptionAttrSetToDocList = attrs:
|
||||||
throw ("No description ${toString l} : ${lib.whatis attrs}");
|
let options = collect isOption attrs; in
|
||||||
}
|
fold (opt: rest:
|
||||||
// (if attrs ? example then {inherit(attrs) example;} else {} )
|
let
|
||||||
// (if attrs ? default then {inherit(attrs) default;} else {} )
|
docOption = {
|
||||||
// {name = l;}
|
inherit (opt) name;
|
||||||
)]
|
description = if opt ? description then opt.description else
|
||||||
else (concatLists (map (s: (optionAttrSetToDocList
|
throw "Option ${opt.name}: No description.";
|
||||||
(l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs)))
|
}
|
||||||
(attrNames attrs)));
|
// (if opt ? example then {inherit(opt) example;} else {})
|
||||||
|
// (if opt ? default then {inherit(opt) default;} else {});
|
||||||
|
|
||||||
|
subOptions =
|
||||||
|
if opt ? options then
|
||||||
|
newOptionAttrSetToDocList opt.options
|
||||||
|
else
|
||||||
|
[];
|
||||||
|
in
|
||||||
|
[ docOption ] ++ subOptions ++ rest
|
||||||
|
) [] options;
|
||||||
|
|
||||||
|
|
||||||
/* Option Properties */
|
/* Option Properties */
|
||||||
# Generalize the problem of delayable properties. Any property can be created
|
# Generalize the problem of delayable properties. Any property can be created
|
||||||
|
Loading…
Reference in New Issue
Block a user