unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Alex Sassmannshausen <alex.sassmannshausen@gmail.com>
To: Zelphir Kaltstahl <zelphirkaltstahl@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: guile-user Digest, Vol 188, Issue 9
Date: Tue, 10 Jul 2018 11:50:22 +0200	[thread overview]
Message-ID: <87y3ejxvvl.fsf@gmail.com> (raw)
In-Reply-To: <349a3f85-4bae-3a35-4a1f-08cd6385255b@gmail.com>

Hi Zelphir,

Just as a heads up — this is perhaps a little tangential.  I created the
guile-config package
(https://gitlab.com/a-sassmannshausen/guile-config), which builds on
getopt-long to provide a (IMHO) richer and more sustainable approach to
managing commandline options for a program.

Just figured you might be interested to have a look, as you were curious
about the subject matter.

HTH,

Alex

Zelphir Kaltstahl writes:

> On 08.07.2018 18:00, guile-user-request@gnu.org wrote:
>> ------------------------------
>>
>> Message: 3
>> Date: Sun, 8 Jul 2018 08:44:22 -0700
>> From: Matt Wette <matt.wette@gmail.com>
>> To: guile-user@gnu.org
>> Subject: Re: Parsing command line arguments, predicate error
>> Message-ID: <e9c9c87b-389d-70d1-7afe-13a0b03e168d@gmail.com>
>> Content-Type: text/plain; charset=utf-8; format=flowed
>>
>>
>>
>> On 07/08/2018 04:49 AM, Zelphir Kaltstahl wrote:
>>> Hi!
>>>
>>> I decided to take a look at how one can parse command line arguments in
>>> Guile and was looking for something like argparse in Python. It seems
>>> that (use-modules (ice-9 getopt-long)) does the job, except that I hit
>>> one problem and don't know what the mistake I am making is. It seems to
>>> be connected to the usage of `predicate` in my code.
>> You probably want to use quasi-quote + unquote:
>>  ? `((version ... (predicate ,string-exact-integer?))))
>>
>> I believe the module (srfi srfi-37), args-fold, is now recommended over 
>> getopt-long.
>>
>> Matt
>
> That solved the problem, thank you Matt!
> I was so far quite fond of the way one specifies options with
> getopt-long, but the quasi-quote unquote was not mentioned in the Guile
> docs and feels unnatural. There seems to be no reason for it to force me
> to do that, except that it does not work otherwise. I'll probably look
> into how it is done with SRFI-37, because of this.
>
> Apart from this issue, what are the reasons for SRFI-37 to be
> recommended over getopt-long?




  parent reply	other threads:[~2018-07-10  9:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.77.1531065622.9222.guile-user@gnu.org>
2018-07-08 17:00 ` guile-user Digest, Vol 188, Issue 9 Zelphir Kaltstahl
2018-07-08 17:10   ` Matt Wette
2018-07-09  3:42   ` Keith Wright
2018-07-09  6:24     ` Zelphir Kaltstahl
2018-07-10  9:50   ` Alex Sassmannshausen [this message]
2018-07-10 20:10     ` Guile Config Zelphir Kaltstahl
2018-07-11 13:33       ` Alex Sassmannshausen
2018-07-15 10:47         ` Zelphir Kaltstahl

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=87y3ejxvvl.fsf@gmail.com \
    --to=alex.sassmannshausen@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=zelphirkaltstahl@gmail.com \
    /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).