---- On Wed, 15 Jan 2020 16:08:51 -0500 Alex Sassmannshausen <alex.sassmannshau...@gmail.com> wrote ---- > Hi! > > sirgazil <sirga...@zoho.com> writes: > > > […] > > > > I'm trying out guile-config to declare the CLI of the program using a > > <configuration> 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 …) property of each > subcommand <configuration> 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 actually not what I wanted... > > […] > > > > So, for example, using the <codex> 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 <codex>). 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: > > (match (full-command options) ; options is a <codex> > ((_ "start") > (sprinkler-start (option-ref options '(id)))) ; id is arg, not key > …) Thank you Alex, that solves, my problem :)