mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-23 20:25:08 +02:00
docs: ignore option aliases
This commit is contained in:
parent
09cefd2751
commit
1cc77f4252
1 changed files with 22 additions and 2 deletions
|
@ -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 != {};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue