From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id XJZbOYEbdWDZBQEAgWs5BA (envelope-from ) for ; Tue, 13 Apr 2021 06:18:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CIhCMoEbdWApQAAA1q6Kng (envelope-from ) for ; Tue, 13 Apr 2021 04:18:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9412495FD for ; Tue, 13 Apr 2021 06:18:09 +0200 (CEST) Received: from localhost ([::1]:40406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWAV6-0007eJ-Oy for larch@yhetil.org; Tue, 13 Apr 2021 00:18:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWAV0-0007e7-Ic for guix-patches@gnu.org; Tue, 13 Apr 2021 00:18:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lWAV0-00065V-BJ for guix-patches@gnu.org; Tue, 13 Apr 2021 00:18:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lWAV0-0004jV-7j for guix-patches@gnu.org; Tue, 13 Apr 2021 00:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47741] [PATCH 2/3] services: configuration: Add syntactic sugar to easily generate documentation. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 13 Apr 2021 04:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47741 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47741@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 47741-submit@debbugs.gnu.org id=B47741.161828745418133 (code B ref 47741); Tue, 13 Apr 2021 04:18:02 +0000 Received: (at 47741) by debbugs.gnu.org; 13 Apr 2021 04:17:34 +0000 Received: from localhost ([127.0.0.1]:58708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWAUY-0004iP-Bo for submit@debbugs.gnu.org; Tue, 13 Apr 2021 00:17:34 -0400 Received: from mail-qv1-f45.google.com ([209.85.219.45]:44968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWAUW-0004hy-Jh for 47741@debbugs.gnu.org; Tue, 13 Apr 2021 00:17:32 -0400 Received: by mail-qv1-f45.google.com with SMTP id o11so7461181qvh.11 for <47741@debbugs.gnu.org>; Mon, 12 Apr 2021 21:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r+Sv/DBQPtvyc/dovVnUzGhBkeik2XUD0qdDsN65sEs=; b=auQdg2PFYsZiIIUGFSJRVjXdunzHva7FS/Pa13CYP8CFxf40qwFD5mlVS2MVO9uMTt yl1BaDscqqSYktHuyzqZuU9tCTd1Lk0W/hy1diba4rvXA5XyOHElRec/5/fZDN20o264 ztKqdi8JcZvyjtQnU0i7OPc3f3AihhHKaUmwbXj9Hk/potr0bmgkNEgnCDzYrzbkbKD9 oBvGoJaa1QwPXjQdEhN/hunfRpOhmd3dmrwxz7AMCWGIqwQAdla5ictfBZMs0WYLc7gc LbiYzBJ5oaMIw1G/8+Kw0K7qSR0n9md9oGseQgxeN0Ocnjgn9UjyGeCx+iXUJ9eSHxlS 6B6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r+Sv/DBQPtvyc/dovVnUzGhBkeik2XUD0qdDsN65sEs=; b=EVNpTfNm2yLUk6dt1h+LyIny2Hj/VKhtrK6nxJTbnJeGVlOVN2gFblYJK05FE2X3bV teKvvXsOopxXyrIVJQTTD6H2x7XDoUxZkww58fYT04EC579hgY2zjtTLphH9ziM56qce NsRLvCypZfhDAOaCjBGA0VNp18DxHO1Y0YORYA1oHl1Xk37y8Z+x5TO0otyzGcGIU83A NqIzo6MYLHVTFowXyJxDYW/6f7KZw4d2dH++06lrExFIsZ/FJN+jl5aIM710vL335m1F P5RWpz72CrC88kQHqUPYJvBEbdgc/DbFHRXqEOTpXbdr6dN+CpKryIOzhCChnsqoZOKe K7mg== X-Gm-Message-State: AOAM531vfqPWxDbU3Z8owETVAOez7tP83nFu66RvS/4IvDhX5EXsINkp ylnM0l8JOjvJ8zbKg9M3HUu4SM/yTX0= X-Google-Smtp-Source: ABdhPJzWHxwgznPCs113VnL+lLDm0xaXAzbWKV8/Ur1LCb9ln7S1wIz1NmNRO/O/majCZpaLsPopog== X-Received: by 2002:ad4:4a6f:: with SMTP id cn15mr30513242qvb.56.1618287447095; Mon, 12 Apr 2021 21:17:27 -0700 (PDT) Received: from localhost.localdomain (dsl-10-128-209.b2b2c.ca. [72.10.128.209]) by smtp.gmail.com with ESMTPSA id w1sm7414074qto.85.2021.04.12.21.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 21:17:26 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 13 Apr 2021 00:17:09 -0400 Message-Id: <20210413041710.1708-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210413041710.1708-1-maxim.cournoyer@gmail.com> References: <20210413041710.1708-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618287489; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=r+Sv/DBQPtvyc/dovVnUzGhBkeik2XUD0qdDsN65sEs=; b=hMA2GbkG7275tVvpYzs3jLJVzzGTVNC44YY1Z4BE/ozBBrCXiWAQZdo4Ribm7QPxpe9InV eJXfI/QQMWkgrnTQdWZWYS+q6YsSL3U/OLGhp+VlnTZd6eVtma8mKEryTS/lsGgW0728xr 9Fc8TiLhgbPKfaz/Y1VfsPp5xxjUPvBeph30pca3azAcQ/6gbJVNuC/1Oi28v8vdBCqaQQ ZnIkkU96G6efwJfC+4nRjvU40fgQiZEvbVrTMCWHIEVuyl6oaALCQzzckvDn9tlQ32/G+M wTtHPwh12cAxILGl37oXLm4fLZ2fcR+uzJCtDTL+OsORYXUGuQeTfGXQ6RJFjg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618287489; a=rsa-sha256; cv=none; b=O5fYUPRbadCtbJVjadzXn3YIEJvfTyiE0kfQZI/rsePilkq2YJPyjjaNx9Jot435NklsOA VFvx6cN1XOLh+tsCON2NujAUHy9ZdzpjRHJViXXbf8AtkrKh+FSbZ8CFAmqq0QwuhH9JLn YtJB1Uy4bz5Nue3TbMuIN1dmzoKW/v4JPVuxMkIk3oSxZSHMJG4zhw6ymEqdQcgSaWmBHq P33XkHipET/DAG1FhYo3148XecTx5JLeSsaRKK/pDgwYCmIVD+3XfJxH44aOIvmjK95Olg 6TjtMN2pSV1QBnhN/tf7nZ5wItEaGPDONejU1Xrn4wBj1P5Nb1fxiCXBD9YFiw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=auQdg2PF; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.66 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=auQdg2PF; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 9412495FD X-Spam-Score: 2.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: s0eeOG1oX7aV 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