Re: Feature requests: dependencies between option values; description of option values

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: Feature requests: dependencies between option values; description of option values

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

nlohmann wrote:
> Hello!
>
> I really like gengetopt, but I miss one feature to actually use it in a tool
> of mine.

Hi Niels!

glad you like gengetopt :-)

I also received your previous bug report and will work on that.

see the other following comments (I assume you're already using the most
recent version 2.22, right?)

>
> GNU BPEL2oWFN can be run in a whole different modes. I use one option
> "--mode" to chose one of this modes, e.g. "--mode=net". Additionally, there
> are a lot of parameters, currently invoked via "--parameter", e.g.
> "--parameter=reduce".

gengetopt now supports mode options
(http://www.gnu.org/software/gengetopt/gengetopt.html#Mode-options) but
I don't think this would solve your problem.

I'll try to see what I can do for your request.

>
> Now I miss two features in gengetopt:
>
> 1. I would like to make certain parameters dependend on the mode chosen. For
> example, parameter "reduce" should only be valid together with mode "net".
> As far as I understand, I currently can only express dependence between
> whole options, but not between their chosen values.
>

see above

> 2. I would like to add descriptions not only to the option itself, but also
> to the valid values. I know I could do this with "text" insertions, I like
> the way gengetopt does all the wrapping and layout of the help output.
>

with text insertions could you achieve your goal?  or am I missing
something?

otherwise what syntax (and what help output) would you suggest?

> I know I could solve my problems by giving each mode value a single option,
> e.g. "--net" or "--small", but I don't want to change the set of command
> line parameters just because switching to gengetopt.
>
> I hope you can help me. Again, great tool!

thanks!

hope to hear from you soon
cheers
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt


Re: Feature requests: dependencies between option values; description of option values

by nlohmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lorenzo,

>
> see the other following comments (I assume you're already using the  
> most recent version 2.22, right?)

I am using the patch you sent me: 2.22.1 (which perfectly solved the  
bug I filed).

>> GNU BPEL2oWFN can be run in a whole different modes. I use one option
>> "--mode" to chose one of this modes, e.g. "--mode=net".  
>> Additionally, there
>> are a lot of parameters, currently invoked via "--parameter", e.g.
>> "--parameter=reduce".
>
> gengetopt now supports mode options (http://www.gnu.org/software/gengetopt/gengetopt.html#Mode-options 
> ) but I don't think this would solve your problem.

Not really: as far as I understand, I can only describe dependencies  
between options, but not their values.

> I'll try to see what I can do for your request.
>
>> Now I miss two features in gengetopt:
>> 1. I would like to make certain parameters dependend on the mode  
>> chosen. For
>> example, parameter "reduce" should only be valid together with mode  
>> "net".
>> As far as I understand, I currently can only express dependence  
>> between
>> whole options, but not between their chosen values.
>
> see above
>
>> 2. I would like to add descriptions not only to the option itself,  
>> but also
>> to the valid values. I know I could do this with "text" insertions,  
>> I like
>> the way gengetopt does all the wrapping and layout of the help  
>> output.
>
> with text insertions could you achieve your goal?  or am I missing  
> something?
Of course, I could. But then I would have to take care about wrapping  
and indenting (see example below)...

> otherwise what syntax (and what help output) would you suggest?
>>
>

Alright, here is need:

Assume two parameters "type" and "option" with several possible values.

1. Only some combinations should be valid, e.g. option="reduce" should  
only work for type="IG" or type="OG".
2. I want to skip the lengthy list of all possible values in the  
standard help.
3. I want a detailed description of each possible value in the  
detailed help.

Example for --help:

----------------------------------------------------------------------
   -t, --type=TYPE      Selects the type of the data structure to
                          calculate. (mandatory)
   -o, --option=OPTION  Selects additional options for the calculation.
----------------------------------------------------------------------

Example for --detailed-help

----------------------------------------------------------------------
   -t, --type=TYPE      Selects the type of the data structure to
                          calculate. (mandatory)

       TYPE can be one of the following values:
         `OG'  compute operating guideline
         `IG'  compute interaction graph
         `PV'  calculate the public view of a given OG (the result
                 is an automaton in OG file format)

   -o, --option=OPTION  Selects additional options for the calculation.

       OPTION can be one of the following values:
         `reduce'             use node reduction which stores less
                                states per IG/OG node (reduces memory,
                                but increases time)
         `multipledeadlocks'  create multiple deadlocks of public view
----------------------------------------------------------------------

Syntax proposal for a cmdline.ggo:

----------------------------------------------------------------------
option "type" t
   "Selects the type of the data structure to calculate."
   details="TYPE can be one of the following values:"
   string values="OG", "IG", "PV" enum
   valuedetails="compute operating guideline", "compute interaction  
graph", "calculate the public view of a given OG (the result is an  
automaton in OG file format)"
   typestr="TYPE"
   required
   hide-possible-values

option "option" o
   "Selects additional options for the calculation."
   details="OPTION can be one of the following values:"
   string values="reduce", "multipledeadlocks" enum
   valuedetails="use node reduction (IG or OG) which stores less  
states per IG/OG node (reduces memory, but increases time)", "create  
multiple deadlocks of public view"
   valuedependon="reduce" "type" "OG"
   valuedependon="reduce" "type" "IG"
   valuedependon="multipledeadlocks" "type" "PV"
   typestr="OPTION"
   optional
   hide-possible-values
----------------------------------------------------------------------

It's just a proposal, but I don't think I'm the only one in the world  
who would like to have stuff like this generated instead of coding it  
myself.

- "valuedetails" would be a comma-separated list of strings, each  
documenting the value with the same index. There, it would be  
extremely nice of gengetopt could take care of wrapping and indentation.

- "hide-possible-values" would do what is says: hides the listing of  
the possible values. I have another project where an option accepts  
values from 1 to 21 -- this does not look too nice when each value is  
listed... (by the way: Why are all values listed with "" (e.g. "5"),  
and why are default values listed with `' (e.g. `five')?)

- "valuedependon" would express dependencies between values of the  
given option and values of another option. It's not a nice syntax, and  
probably misleading because the repeated mentioning of "reduce" in the  
example above could also be understood as the requirement to have  
"type" set to "OG" _and_ "IG". An alternative could be a list of  
constraints that should hold, e.g.

----------------------------------------------------------------------
"option"="reduce" DEPENDS_ON ("type"="IG" OR "type"="OG")
"option"="multipledeadlocks" DEPENDS_ON ("type"="PV")
----------------------------------------------------------------------

Anyway, if there are things left unclear, I am happy to render my  
example more precisely.

Thanks for the quick responses,
cheers,
Niels.

_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

smime.p7s (3K) Download Attachment