unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile-config: How do I use a <codex>?
@ 2020-01-15 19:13 sirgazil
  2020-01-15 21:08 ` Alex Sassmannshausen
  0 siblings, 1 reply; 3+ messages in thread
From: sirgazil @ 2020-01-15 19:13 UTC (permalink / raw)
  To: Guile User

I designed the following CLI for an example program that pretends to control irrigation sprinklers.

  $ sprinklers
  Display some information about the sprinklers in the farm.

  $ sprinklers start-all
  All sprinklers started.

  $ sprinklers stop-all
  All sprinklers stopped.

  $ sprinklers start A5
  Sprinkler A5 started.

  $ sprinklers stop A5
  Sprinkler A5 stopped.

All subcommands accept a --oscillate flag. For example:

  $ sprinklers start --oscillate A5
  Sprinkler A5 started in oscillation mode.

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) and I have defined a "dispatcher" procedure that is supposed to run some Guile procedure depending on the command entered by the user (https://gitlab.com/sirgazil/guile-lab/blob/master/scripts/cli/sprinklers#L165). But I don't understand how to use the <codex> record for that purpose (I'm currently matching command patterns against the result of (command-line) instead to make the example program work).

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) ...)


Thanks,

---
https://sirgazil.bitbucket.io/







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-15 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 19:13 guile-config: How do I use a <codex>? sirgazil
2020-01-15 21:08 ` Alex Sassmannshausen
2020-01-15 23:18   ` sirgazil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).