Re: Re: wishlist: mandatory parameters
Lorenzo Bettini <[email protected]>
| Newsgroups | gmane.comp.gnu.gengetopt.general |
|---|---|
| Message-ID | <[email protected]> |
Papp Gyozo (VBuster) wrote:
>> I want, with the help of "mandatory parameter", it can be:
>>
>> Usage: sample1 [OPTIONS]... SOURCE DEST
>>
>> SOURCE mandatory parameter to ...
>> DEST ... copy SOURCE to DEST
>
> Actually SOURCE and DEST is called unnamed options in gengetopt because as you figured out earlier it deals with options: ie. commandline arguments starting with one or two dashes. All above this (the rest) are assembled and stored into the array 'inputs' of the args_info structure, and are refered to unnamed options.
>
> I think what you really want is to be able to name some of the unnamed options (SOURCE & DEST) and to use those as a normal mandatory parameters. If those are missing prgram exits with failure. Am I right?
>
> hint: gengetopt --help | grep -i unname
>
hi everyone!
I've put up some modifications to deal with these issues. You can find
a candidate release here:
http://rap.dsi.unifi.it/~bettini/gengetopt-2.19rc.tar.gz
the main changes are:
* strings can spawn more than one line and contain escaped "
* usage string can be specified (instead of being generated automatically).
* automatically created usage strings are wrapped.
* with --long-help the optional options are correctly printed between []
* --show-required, to explicitly print in the help output whether an
option is mandatory
this issues some of the problems enlighted by Tong
as for unnamed options, for the moment they are left to the programmer
(but some possible features might be added to gengetopt to deal with
them), because they usually represent a list (with unspecified lenght)
of input files...
however, for the moment, one can specify a customized usage string, in
order to obtain the line
Usage: sample1 [OPTIONS]... SOURCE DEST
I look forward to hearing feedback :-)
cheers
Lorenzo
--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| PhD in Computer Science, DSI, Univ. di Firenze |
| Florence - Italy (GNU/Linux User # 158233) |
| http://www.lorenzobettini.it |
| http://tronprog.blogspot.com BLOG |
| http://www.purplesucker.com Deep Purple Cover Band |
| http://www.gnu.org/software/src-highlite |
| http://www.gnu.org/software/gengetopt |
| http://www.lorenzobettini.it/software/gengen |
| http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+