unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] getopt-long permits numbers for short options.
@ 2023-09-05  6:04 Marius Bakke
  2023-09-05  6:25 ` Janneke Nieuwenhuizen
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Bakke @ 2023-09-05  6:04 UTC (permalink / raw)
  To: guile-devel

* module/ice-9/getopt-long.scm (short-opt-rx): Add 0-9.
---
 module/ice-9/getopt-long.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/ice-9/getopt-long.scm b/module/ice-9/getopt-long.scm
index 18b235390..0077183da 100644
--- a/module/ice-9/getopt-long.scm
+++ b/module/ice-9/getopt-long.scm
@@ -221,7 +221,7 @@
 	  ((string=? "--" (car no)) (cons (reverse yes) (cdr no)))
 	  (else (loop (cons (car no) yes) (cdr no))))))
 
-(define short-opt-rx           (make-regexp "^-([a-zA-Z]+)(.*)"))
+(define short-opt-rx           (make-regexp "^-([a-zA-Z0-9]+)(.*)"))
 (define long-opt-no-value-rx   (make-regexp "^--([^=]+)$"))
 (define long-opt-with-value-rx (make-regexp "^--([^=]+)=(.*)"))
 
-- 
2.41.0




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

* Re: [PATCH] getopt-long permits numbers for short options.
  2023-09-05  6:04 [PATCH] getopt-long permits numbers for short options Marius Bakke
@ 2023-09-05  6:25 ` Janneke Nieuwenhuizen
  2023-09-05 11:08   ` Dale Mellor
  2023-09-05 11:58   ` Marius Bakke
  0 siblings, 2 replies; 4+ messages in thread
From: Janneke Nieuwenhuizen @ 2023-09-05  6:25 UTC (permalink / raw)
  To: Marius Bakke; +Cc: guile-devel

Marius Bakke writes:

> * module/ice-9/getopt-long.scm (short-opt-rx): Add 0-9.

Hehe, reminds me of

    https://lists.gnu.org/archive/html/bug-guile/2018-07/msg00009.html

> diff --git a/module/ice-9/getopt-long.scm b/module/ice-9/getopt-long.scm
> index 18b235390..0077183da 100644
> --- a/module/ice-9/getopt-long.scm
> +++ b/module/ice-9/getopt-long.scm
> @@ -221,7 +221,7 @@
>  	  ((string=? "--" (car no)) (cons (reverse yes) (cdr no)))
>  	  (else (loop (cons (car no) yes) (cdr no))))))
>  
> -(define short-opt-rx           (make-regexp "^-([a-zA-Z]+)(.*)"))
> +(define short-opt-rx           (make-regexp "^-([a-zA-Z0-9]+)(.*)"))
>  (define long-opt-no-value-rx   (make-regexp "^--([^=]+)$"))
>  (define long-opt-with-value-rx (make-regexp "^--([^=]+)=(.*)"))

FWIW, LGTM :)

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com



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

* Re: [PATCH] getopt-long permits numbers for short options.
  2023-09-05  6:25 ` Janneke Nieuwenhuizen
@ 2023-09-05 11:08   ` Dale Mellor
  2023-09-05 11:58   ` Marius Bakke
  1 sibling, 0 replies; 4+ messages in thread
From: Dale Mellor @ 2023-09-05 11:08 UTC (permalink / raw)
  To: Janneke Nieuwenhuizen, Marius Bakke; +Cc: guile-devel

On Tue, 2023-09-05 at 08:25 +0200, Janneke Nieuwenhuizen wrote:
> Marius Bakke writes:
> 
> > * module/ice-9/getopt-long.scm (short-opt-rx): Add 0-9.
> 
> Hehe, reminds me of
> 
>    
> https://lists.gnu.org/archive/html/bug-guile/2018-07/msg00009.html
> 
> 

Also note https://debbugs.gnu.org/db/42/42669.html.  You see, your
solution fails if '-1' were supposed to be read literally as a
positional parameter.  The only solution is to make getopt-long more
intelligent in how it applies the pattern specification.

On the whole, both mine and Marius' patches are now years old and the
outstanding bug list is massive; these things are not going to get done
without a sea-change in the project administration.

Dale




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

* Re: [PATCH] getopt-long permits numbers for short options.
  2023-09-05  6:25 ` Janneke Nieuwenhuizen
  2023-09-05 11:08   ` Dale Mellor
@ 2023-09-05 11:58   ` Marius Bakke
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Bakke @ 2023-09-05 11:58 UTC (permalink / raw)
  To: Janneke Nieuwenhuizen; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

Janneke Nieuwenhuizen <janneke@gnu.org> skriver:

> Marius Bakke writes:
>
>> * module/ice-9/getopt-long.scm (short-opt-rx): Add 0-9.
>
> Hehe, reminds me of
>
>     https://lists.gnu.org/archive/html/bug-guile/2018-07/msg00009.html

Hey, time flies...  There is now:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42669

...which avoids the test failure mentioned in #32154.

(actually the tests do not fail, but merely prints UNRESOLVED, which I
missed due to exit code 0 ... that seems like a bug, but anyway.)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

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

end of thread, other threads:[~2023-09-05 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05  6:04 [PATCH] getopt-long permits numbers for short options Marius Bakke
2023-09-05  6:25 ` Janneke Nieuwenhuizen
2023-09-05 11:08   ` Dale Mellor
2023-09-05 11:58   ` Marius Bakke

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