GNU bug report logs - #47741
[PATCH 0/3] Add a service for OpenDHT

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Tue, 13 Apr 2021 04:16:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 47741 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 47741 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 2/3] services: configuration: Add syntactic sugar to easily
 generate documentation.
Date: Tue, 13 Apr 2021 00:17:09 -0400
I found the original (undocumented) interface difficult to understand, which
was the rationale for adding a simpler one on top of it.

* gnu/services/configuration.scm (configuration->documentation): New procedure.
---
 gnu/services/configuration.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 90f12a8d39..750535342d 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -43,6 +43,7 @@
             define-configuration
             validate-configuration
             generate-documentation
+            configuration->documentation
             serialize-package))
 
 ;;; Commentary:
@@ -188,3 +189,15 @@
                       (or (assq-ref sub-documentation field-name) '())))))
             fields)))))
   (stexi->texi `(*fragment* . ,(generate documentation-name))))
+
+(define (configuration->documentation configuration-symbol)
+  "Takes CONFIGURATION-SYMBOL, the symbol used when defining a configuration
+record with DEFINE-CONFIGURATION, and outputs the Texinfo documentation of its
+fields."
+  ;; This is syntax sugar for a simple, straight-forward application of
+  ;; GENERATE-DOCUMENTATION.
+  (let ((fields-getter (module-ref (current-module)
+                                   (symbol-append configuration-symbol
+                                                  '-fields))))
+    (format #t (generate-documentation `((,configuration-symbol ,fields-getter))
+                                       configuration-symbol))))
-- 
2.31.1





This bug report was last modified 4 years and 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.