mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
lib/helpers: add defaultNullOpts.mkLogLevel
This commit is contained in:
parent
290855ed3d
commit
a70947a563
1 changed files with 31 additions and 0 deletions
|
@ -193,6 +193,37 @@ with lib; rec {
|
|||
else ''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
mkLogLevel = default: desc:
|
||||
mkOption {
|
||||
type = with types;
|
||||
nullOr
|
||||
(
|
||||
either ints.unsigned
|
||||
(
|
||||
enum
|
||||
["off" "error" "warn" "info" "debug" "trace"]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
apply =
|
||||
mapNullable
|
||||
(
|
||||
value:
|
||||
if isInt value
|
||||
then value
|
||||
else mkRaw "vim.log.levels.${strings.toUpper value}"
|
||||
);
|
||||
description = let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue