[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Re: getopt() as gtroff macro ?
From: |
Keith Marshall |
Subject: |
Re: [Groff] Re: getopt() as gtroff macro ? |
Date: |
Sun, 26 Sep 2004 09:54:49 +0100 |
On Friday 24 September 2004 3:44 pm, Werner LEMBERG wrote:
> > both the long or the short ones (one could choose between
> > readability and conciseness). Flags would always be numeric
> > (essentially boolean) and options with values would always return a
> > string, which if numeric would require a unit designator (as above).
> > If the string is used in a numeric context, it would be converted to
> > that first:
>
> Maybe a synthesis of a function call for error handling and register
> assignments is the way to go. Here another try, incorporating your
> ideas:
>
> .getopt <prefix> <options> <long options> <arguments>
>
> Example:
>
> .de foo
> . getopt "foox" "ac:" "--all --check=" \\$@
> . ...
> ..
>
> The .getopt command would do
>
> .ds <prefix><option> <argument> \" option with argument
> .nr <prefix><option> 1 \" option without argument
>
> It will call the function `<prefix>-?' (with <option> as the argument)
> if <option> is invalid. Finally, it will apply a proper `.shift' call
> so that after .getopt parameter \$1 is the first non-option argument.
>
> Calling the above function like this
>
> .foo -a -c bar --all --check=urgh --xxx arg1 arg2
>
> would consequently do the following assignments
>
> .nr foox-a 1
> .ds foox-c bar
> .nr foox--all 1
> .ds foox--check urgh
>
> and this macro call:
>
> .foox-? --xxx
IMHO, this should satisfy all reasonable requirements. Lets go for it!!!
Best regards,
Keith.
- Re: [Groff] Re: getopt() as gtroff macro ?, (continued)
[Groff] Re: getopt() as gtroff macro ?, Steve Izma, 2004/09/23
Re: [Groff] Re: getopt() as gtroff macro ?, Keith MARSHALL, 2004/09/24
Re: [Groff] Re: getopt() as gtroff macro ?, Keith MARSHALL, 2004/09/24