plugins/which-key: move listOfLen to lib.types

Allows us to require a list to have a certain length for plugins that
request it.
This commit is contained in:
Austin Horstman 2024-08-13 08:05:55 -05:00 committed by GaetanLepage
parent 4eb2ad7db7
commit e3ec1c4a46
2 changed files with 10 additions and 10 deletions

View file

@ -81,6 +81,15 @@ rec {
# Overridden when building the documentation
eitherRecursive = either;
listOfLen =
elemType: len:
addCheck (listOf elemType) (v: builtins.length v == len)
// {
description = "list of ${toString len} ${
optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType
}";
};
}
# Allow to do `with nixvimTypes;` instead of `with types;`
// lib.types