From: Xinglu Chen <public@yoctocell.xyz>
To: 48934@debbugs.gnu.org
Subject: [bug#48934] [PATCH 2/2] services: configuration: Show default value when it is a
Date: Wed, 09 Jun 2021 15:06:27 +0200 [thread overview]
Message-ID: <9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz> (raw)
In-Reply-To: <cover.1623243063.git.public@yoctocell.xyz>
* gnu/services/configuration.scm (generate-documentation): If the default
value of a field is a package, show the value of the ‘name’ field of the
package. This might not be the correct name in some cases though.
---
gnu/services/configuration.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index abcbc70520..99687d065a 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -252,12 +252,20 @@ does not have a default value" field kind)))
(configuration-field-default-value-thunk f)
(lambda _ '%invalid))))
(define (show-default? val)
- (or (string? val) (number? val) (boolean? val)
+ (or (string? val) (number? val) (boolean? val) (package? val)
(and (symbol? val) (not (eq? val '%invalid)))
(and (list? val) (and-map show-default? val))))
+
+ (define (show-default val)
+ (cond
+ ((package? val)
+ ;; Maybe not always correct.
+ (package-name val))
+ (else (str val))))
+
`(entry (% (heading (code ,(str field-name))
,@(if (show-default? default)
- `(" (default: " (code ,(str default)) ")")
+ `(" (default: " (code ,(show-default default)) ")")
'())
" (type: "
,(str field-type)
--
2.32.0
next prev parent reply other threads:[~2021-06-09 13:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 13:04 [bug#48934] [PATCH 0/2] Some improvements to (gnu services configuration) Xinglu Chen
2021-06-09 13:06 ` [bug#48934] [PATCH 1/2] services: configuration: Change formatting of generated Xinglu Chen
2021-08-02 18:10 ` [bug#48934] [PATCH 0/2] Some improvements to (gnu services configuration) Maxim Cournoyer
2021-06-09 13:06 ` Xinglu Chen [this message]
2021-08-02 18:21 ` bug#48934: " Maxim Cournoyer
2021-08-03 7:24 ` [bug#48934] " Xinglu Chen
2021-08-03 14:38 ` Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9de0174c0818edd7c3f1f58a264a6ea3c5c3be50.1623243063.git.public@yoctocell.xyz \
--to=public@yoctocell.xyz \
--cc=48934@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).