From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: sirgazil Newsgroups: gmane.lisp.guile.user Subject: Re: guile-config: How do I use a ? Date: Wed, 15 Jan 2020 18:18:03 -0500 Message-ID: <16fab7fe41b.fb7b06f570314.1315526716710185935@zoho.com> References: <16faaa06bfd.db91abab66860.6304475598181299647@zoho.com> <87ftgg2zrw.fsf@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="122859"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Zoho Mail Cc: "guile-user" To: "alexsassmannshausen" Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Jan 16 00:18:28 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 1irrvg-000Vvg-Nj for guile-user@m.gmane-mx.org; Thu, 16 Jan 2020 00:18:28 +0100 Original-Received: from localhost ([::1]:34034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irrvf-0005Wt-OH for guile-user@m.gmane-mx.org; Wed, 15 Jan 2020 18:18:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48723) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irrvU-0005Wj-R3 for guile-user@gnu.org; Wed, 15 Jan 2020 18:18:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irrvT-0004io-4h for guile-user@gnu.org; Wed, 15 Jan 2020 18:18:16 -0500 Original-Received: from sender4-pp-o91.zoho.com ([136.143.188.91]:25195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irrvS-0004hI-H8 for guile-user@gnu.org; Wed, 15 Jan 2020 18:18:15 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=date:from:to:cc:message-id:in-reply-to:references:subject:mime-version:content-type:user-agent; b=mEJV0oMxLX5pc3wpd2mRJmgAMvSacw8QLAImNp9nQEPZWflHN9F49axRIMIEEr0qJ74W700Xrh/Y HqlIig7++e2x99g7jfXgYeu+DJbEc0Tso95fkNbqgHQYxpR9USbK DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1579130290; s=zm2020; d=zoho.com; i=sirgazil@zoho.com; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=nyMB0ChrR3h6C0i15rA828rW3O45cIsra92sIl1lQpA=; b=X6n0jMtbh3lQnWi/DYFbMJHRrMvCB/scGMOpZCMq7Xt0+62zAzBUkslB3pM1TZ8a uIOZ2Jy00bk6RAh/97E1fRiGn8vIR6g1L62NvMMijn5pqmFWw+b3rq4zep7orcMAEGL MXLPuMhWB0kWm35vjWkXblAJN/mDlFimDKgIj3uU= Original-Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1579130283037703.7613232499515; Wed, 15 Jan 2020 15:18:03 -0800 (PST) Original-Received: from [179.15.13.185] by mail.zoho.com with HTTP;Wed, 15 Jan 2020 15:18:03 -0800 (PST) In-Reply-To: <87ftgg2zrw.fsf@gmail.com> X-Priority: Medium X-Mailer: Zoho Mail X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 136.143.188.91 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:16067 Archived-At: ---- On Wed, 15 Jan 2020 16:08:51 -0500 Alex Sassmannshausen wrote ---- > Hi! >=20 > sirgazil writes: >=20 > > [=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/sprinkl= ers#L96) >=20 > 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 ea= ch > subcommand object to say you would like to inherit > oscillate from its parent. I think this one is documented correctly in > the manual! :-) Yeah, I thought about it, but running "sprinklers --help" displayed the "--= oscillate" flag as an option of the "sprinklers" command too, which is actu= ally not what I wanted... > > [=E2=80=A6] > > > > So, for example, using the record, how would I map the followi= ng command > > > > $ sprinklers start A5 > > > > to a Guile procedure like > > > > (define (sprinkler-start id) ...) >=20 > I think this is one place for the documentation of config let you down! >=20 > 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. Oh, right, the "full-command" procedure is not documented in the manual. > This is how I tend to use it: >=20 > (match (full-command options) ; options is a > ((_ "start") > (sprinkler-start (option-ref options '(id)))) ; id is arg, not key > =E2=80=A6) =20 Thank you Alex, that solves, my problem :)