Merge pull request #230353 from ncfavier/defaultText-only

lib/options: fix rendering of options with only a defaultText
This commit is contained in:
Naïm Favier 2023-05-08 14:38:35 +02:00 committed by GitHub
commit 6674b8a6f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,7 +261,7 @@ rec {
concatMap (opt: concatMap (opt:
let let
name = showOption opt.loc; name = showOption opt.loc;
docOption = rec { docOption = {
loc = opt.loc; loc = opt.loc;
inherit name; inherit name;
description = opt.description or null; description = opt.description or null;
@ -280,9 +280,9 @@ rec {
renderOptionValue opt.example renderOptionValue opt.example
); );
} }
// optionalAttrs (opt ? default) { // optionalAttrs (opt ? defaultText || opt ? default) {
default = default =
builtins.addErrorContext "while evaluating the default value of option `${name}`" ( builtins.addErrorContext "while evaluating the ${if opt?defaultText then "defaultText" else "default value"} of option `${name}`" (
renderOptionValue (opt.defaultText or opt.default) renderOptionValue (opt.defaultText or opt.default)
); );
} }