From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alex Sassmannshausen Newsgroups: gmane.lisp.guile.user Subject: Re: guile-config: How do I use a ? Date: Wed, 15 Jan 2020 22:08:51 +0100 Message-ID: <87ftgg2zrw.fsf@gmail.com> References: <16faaa06bfd.db91abab66860.6304475598181299647@zoho.com> Reply-To: alex.sassmannshausen@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="111061"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.2.0; emacs 26.3 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Jan 15 22:09:09 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1irpuX-000SrM-AF for guile-user@m.gmane-mx.org; Wed, 15 Jan 2020 22:09:09 +0100 Original-Received: from localhost ([::1]:60702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irpuW-0006hy-6B for guile-user@m.gmane-mx.org; Wed, 15 Jan 2020 16:09:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50527) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irpuM-0006hr-18 for guile-user@gnu.org; Wed, 15 Jan 2020 16:08:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irpuK-0001Ls-J8 for guile-user@gnu.org; Wed, 15 Jan 2020 16:08:57 -0500 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:52326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1irpuK-0001L7-Df for guile-user@gnu.org; Wed, 15 Jan 2020 16:08:56 -0500 Original-Received: by mail-wm1-x334.google.com with SMTP id p9so1516250wmc.2 for ; Wed, 15 Jan 2020 13:08:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:reply-to:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=qD2WfrMpmTORoP6BA5cvGe6xM554h9I3QNMvcoxOckA=; b=uJ4E5P/NFGEnHExbVkuHEI4iO2EIqqU7mEkEogmDaMXCaQ9eSXaS5FUBX0hrIRlKzp e0v0b061Qv/opilKAlpgU0SR5dJVe+q1M/RJFaaf/4Q/9dm22Q75GPS5ZbW/cHzu5Min m9514rShAXQiIzqOlj0oMtM2fbHYH57AxmQYHDNiVRt4ha/GBqoTNirJt/v3zozJGFun bRQ/8wLQJvHMPRLKNMrsM+hXa9+NHwRu7yQ/PAhcFu6VFCvMnG6QnXKu9uTjuM776qbm q/vWEJGqF7yHwVeeKo1Ik3UI2VxoWHn6wDcyZAsIsIQCil40BRiXYyxxd39JvxXK9TEv pnSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:reply-to :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=qD2WfrMpmTORoP6BA5cvGe6xM554h9I3QNMvcoxOckA=; b=muzlfG1JrFoz89iPFajDsv4YswrUpRtX1QAzcGRVWX/fndOU2qkZxUMgCRbTUAgxwZ iPMhh+BkPIpOQhO7k8ywNR2hbUnxHZV0tG8dlAd3qujgBcP6R/9WGnJkzB9X8oUd5F/x Qj6Ig6BivcDi0eU6alTTLmxslPbd4Ev4tH/2cT7MjUX5UmRyvPKcJfEhsDaTkI2qxy/x yTpb624kkLlCJSdxq+eEa25fkFY741+aVHY8Npj2Uquc+uhSGO9f49ayCeS2CcI3wxA7 leWfPrTyyntMbjT0bh1IFmOjeGLjHgZXBnl3yOZJVKzNadSuS67IAbwRViw1BvGUdYeF 2iPQ== X-Gm-Message-State: APjAAAXTXSecDZatC0vuw+NtghyJZMvDE0Z8Oy0qOXAgpUtd6ugGTbQj Eu939kR2iE/qTyP/ZzfzB9vXeqdu X-Google-Smtp-Source: APXvYqwyyefsOMwSVds1sYhAYwgAr0YWXZ9YEJz4B74TZTzcPLqdOSQutMPYkefmchxHEeXKwZjsdw== X-Received: by 2002:a1c:2187:: with SMTP id h129mr2132388wmh.44.1579122534613; Wed, 15 Jan 2020 13:08:54 -0800 (PST) Original-Received: from watership ([2a02:a03f:3e55:2800:bb66:9d33:218e:68a0]) by smtp.gmail.com with ESMTPSA id u14sm25684925wrm.51.2020.01.15.13.08.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 13:08:54 -0800 (PST) In-reply-to: <16faaa06bfd.db91abab66860.6304475598181299647@zoho.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16066 Archived-At: Hi! sirgazil writes: > [=E2=80=A6] > > I'm trying out guile-config to declare the CLI of the program using a > record > (https://gitlab.com/sirgazil/guile-lab/blob/master/scripts/cli/sprinklers= #L96) You can actually make use of config's inheritance here, because oscillate is shared by all subcommands. You can specify oscillate in the top-level command and then use the (wanted =E2=80=A6) property of each subcommand object to say you would like to inherit oscillate from its parent. I think this one is documented correctly in the manual! :-) > [=E2=80=A6] > > So, for example, using the record, how would I map the following = command > > $ sprinklers start A5 > > to a Guile procedure like > > (define (sprinkler-start id) ...) I think this is one place for the documentation of config let you down! The procedure you want to use here is (full-command ). This will give you a list of string elements, each being a "breadcrumb" down the trail of subcommands. This is how I tend to use it: (match (full-command options) ; options is a ((_ "start") (sprinkler-start (option-ref options '(id)))) ; id is arg, not key =E2=80=A6) Hth, Alex