Skip to content

Commit b8c5587

Browse files
committed
lib/keymaps: make mode type's description more readable
Only list the enum values once, instead of twice.
1 parent bd46d89 commit b8c5587

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/keymap-helpers.nix

+10-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ rec {
4444

4545
modeEnum = lib.types.enum modes;
4646

47+
modeType =
48+
with lib.types;
49+
either modeEnum (nonEmptyListOf modeEnum)
50+
// {
51+
description =
52+
"one of or non-empty list of" + lib.strings.removePrefix "one of" modeEnum.description;
53+
descriptionClass = "conjunction";
54+
};
55+
4756
mapOptionSubmodule = mkMapOptionSubmodule { };
4857

4958
# NOTE: options that have the deprecated `lua` sub-option must use `removeDeprecatedMapAttrs`
@@ -55,7 +64,7 @@ rec {
5564
mkModeOption =
5665
default:
5766
lib.mkOption {
58-
type = with lib.types; either modeEnum (listOf modeEnum);
67+
type = modeType;
5968
description = ''
6069
One or several modes.
6170
Use the short-names (`"n"`, `"v"`, ...).

0 commit comments

Comments
 (0)