unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: sirgazil <sirgazil@zoho.com>
To: "Guile User" <guile-user@gnu.org>
Subject: guile-config: How do I use a <codex>?
Date: Wed, 15 Jan 2020 14:13:57 -0500	[thread overview]
Message-ID: <16faaa06bfd.db91abab66860.6304475598181299647@zoho.com> (raw)

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/







             reply	other threads:[~2020-01-15 19:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 19:13 sirgazil [this message]
2020-01-15 21:08 ` guile-config: How do I use a <codex>? Alex Sassmannshausen
2020-01-15 23:18   ` sirgazil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16faaa06bfd.db91abab66860.6304475598181299647@zoho.com \
    --to=sirgazil@zoho.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).