docs: ignore option aliases

This commit is contained in:
wolbyte 2023-08-24 14:50:16 +03:30 committed by Gaétan Lepage
parent 09cefd2751
commit 1cc77f4252

View file

@ -48,19 +48,39 @@ with lib; let
getSubOptions = opts: path: removeUnwanted (opts.type.getSubOptions path); getSubOptions = opts: path: removeUnwanted (opts.type.getSubOptions path);
isVisible = opts:
if isOption opts
then attrByPath ["visible"] true opts
else if opts.isOption
then attrByPath ["index" "options" "visible"] true opts
else let
filterFunc =
filterAttrs
(
_: v:
if isAttrs v
then isVisible v
else true
);
hasEmptyIndex = (filterFunc opts.index.options) == {};
hasEmptyComponents = (filterFunc opts.components) == {};
in
!hasEmptyIndex || !hasEmptyComponents;
wrapModule = path: opts: isOpt: rec { wrapModule = path: opts: isOpt: rec {
index = { index = {
options = options =
if isOpt if isOpt
then opts then opts
else filterAttrs (_: component: component.isOption) opts; else filterAttrs (_: component: component.isOption && (isVisible component)) opts;
path = concatStringsSep "/" path; path = concatStringsSep "/" path;
}; };
components = components =
if isOpt if isOpt
then {} then {}
else filterAttrs (_: component: !component.isOption) opts; else filterAttrs (_: component: !component.isOption && (isVisible component)) opts;
hasComponents = components != {}; hasComponents = components != {};