GNU bug report logs - #21698
accessing multiple flagged values with (ice-9 getopt-long)

Previous Next

Package: guile;

Reported by: Matt Wette <matthew.wette <at> verizon.net>

Date: Sat, 17 Oct 2015 18:29:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Andy Wingo <wingo <at> pobox.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#21698: closed (accessing multiple flagged values with (ice-9
 getopt-long))
Date: Fri, 24 Jun 2016 17:15:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 24 Jun 2016 19:14:28 +0200
with message-id <87mvmacxvv.fsf <at> pobox.com>
and subject line Re: bug#21698: accessing multiple flagged values with (ice-9 getopt-long)
has caused the debbugs.gnu.org bug report #21698,
regarding accessing multiple flagged values with (ice-9 getopt-long)
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
21698: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21698
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Matt Wette <matthew.wette <at> verizon.net>
To: bug-guile <at> gnu.org
Cc: Matthew Wette <matthew.wette <at> verizon.net>
Subject: accessing multiple flagged values with (ice-9 getopt-long)
Date: Sat, 17 Oct 2015 10:05:53 -0700
[Message part 3 (text/plain, inline)]
This is in reference to guile-2.0.11.

The (ice-9 getopt-long) module does not provide a process for accessing multiple command line arguments.

A patch for ice-9/getopt-long.scm  is attached which adds the procedure getopt-ref/many to access multiple argument values.

The following program and results illustrate the use of the current getopt-ref and the proposed getopt-ref/many:

mwette$ ./gotest.scm -f foo1 -b bar1 -f foo2 baz1 baz2
program arguments:
("./gotest.scm" "-f" "foo1" "-b" "bar1" "-f" "foo2" "baz1" "baz2")

getopt using option-ref:
foo: "foo2"
bar: "bar1"

getopt using option-ref/many:
foo: ("foo1" "foo2")
bar: "bar1"


where

mwette$ cat gotest.scm 
#!/opt/local/bin/guile
!#
(use-modules (ice-9 getopt-long))

(define spec
 '((foo (single-char #\f) (value #t))
   (bar (single-char #\b) (value #t))))

(let* ((args (program-arguments))
       (opts (getopt-long args spec)))
  (simple-format #t "program arguments:\n")
  (simple-format #t "~S\n" args)

  (simple-format #t "\ngetopt using option-ref:\n")
  (simple-format #t "foo: ~S\n" (option-ref opts 'foo #f))
  (simple-format #t "bar: ~S\n" (option-ref opts 'bar #f))

  (simple-format #t "\ngetopt using option-ref/many:\n")
  (simple-format #t "foo: ~S\n" (option-ref/many opts 'foo #f))
  (simple-format #t "bar: ~S\n" (option-ref/many opts 'bar #f))
  )
[Message part 4 (text/html, inline)]
[getopt-long.patch (application/octet-stream, attachment)]
[Message part 6 (text/html, inline)]
[Message part 7 (message/rfc822, inline)]
From: Andy Wingo <wingo <at> pobox.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 21698-done <at> debbugs.gnu.org, Matt Wette <matthew.wette <at> verizon.net>
Subject: Re: bug#21698: accessing multiple flagged values with (ice-9
 getopt-long)
Date: Fri, 24 Jun 2016 19:14:28 +0200
On Fri 24 Jun 2016 17:30, ludo <at> gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo <at> pobox.com> skribis:
>
>> Thanks for the patch.  My instinct however is to point you towards
>> SRFI-37, which in addition to supporting multiple argument values can
>> also be used to fold over the precise argument order.  I just don't know
>> that we should be expanding (ice-9 getopt-long); it has its use case and
>> if your needs go beyond it, then probably your needs go way beyond it.
>>
>>   https://www.gnu.org/software/guile/manual/html_node/SRFI_002d37.html
>>
>> Ludovic, second opinions?
>
> Seconded.  I think we should probably “freeze” (ice-9 getopt-long) and
> recommend SRFI-37.

Okeydoke, closing.  Thanks!

Andy


This bug report was last modified 8 years and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.