Skip to content

Commit

Permalink
lib/keymaps: make mode type's description more readable
Browse files Browse the repository at this point in the history
Only list the enum values once, instead of twice.
  • Loading branch information
MattSturgeon committed Feb 15, 2025
1 parent bd46d89 commit b8c5587
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/keymap-helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ rec {

modeEnum = lib.types.enum modes;

modeType =
with lib.types;
either modeEnum (nonEmptyListOf modeEnum)
// {
description =
"one of or non-empty list of" + lib.strings.removePrefix "one of" modeEnum.description;
descriptionClass = "conjunction";
};

mapOptionSubmodule = mkMapOptionSubmodule { };

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

0 comments on commit b8c5587

Please sign in to comment.