mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
lib/options: defaultNullOpts support non-string defaults
This commit is contained in:
parent
deafcf44de
commit
daa6b0f5cf
1 changed files with 14 additions and 1 deletions
|
@ -57,7 +57,20 @@ rec {
|
||||||
|
|
||||||
defaultNullOpts = rec {
|
defaultNullOpts = rec {
|
||||||
# Description helpers
|
# Description helpers
|
||||||
mkDefaultDesc = defaultValue: "Plugin default: `${toString defaultValue}`";
|
mkDefaultDesc =
|
||||||
|
defaultValue:
|
||||||
|
let
|
||||||
|
default =
|
||||||
|
# Assume a string default is already formatted as intended,
|
||||||
|
# historically strings were the only type accepted here.
|
||||||
|
# TODO consider deprecating this behavior so we can properly quote strings
|
||||||
|
if isString defaultValue then
|
||||||
|
defaultValue
|
||||||
|
else
|
||||||
|
generators.toPretty { multiline = false; } defaultValue;
|
||||||
|
in
|
||||||
|
"Plugin default: `${default}`";
|
||||||
|
|
||||||
mkDesc =
|
mkDesc =
|
||||||
default: desc:
|
default: desc:
|
||||||
let
|
let
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue