help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

groupdefault (Re: [help-gengetopt] mutually exclusive group of options)


From: Papp Gyozo (VBuster)
Subject: groupdefault (Re: [help-gengetopt] mutually exclusive group of options)
Date: Wed, 07 Nov 2007 18:26:52 +0100

Hi there,

the time has come I have to sort this thing out in my application. The scenario 
is the following. My app recently copes with a bunch of option with default 
values which is used 9 of 10 times, for example: 

a)     vbscan -as file1 file2 ... 

--vdb, --temp, --quar, --archive-* and such might be used with their default 
values:

b)     vbscan --vdb=... -as file1 ...
c)     vbscan --vdb=... --temp=... -as file1 file2 ...

I have to extend my app with a quite new and different functionality. In this 
case the old defaulted option must not be accepted by the parser or by the app, 
itself. Let's name the distuinguishable option 'attach':

d)     vbscan --attach=... file1 file2 ... # OK
e)     vbscan --attach=... --temp=...      # FAIL, invalid commandline

One thing I came up with was a gengetopt hack about introducing "groupdefault" 
which mimic the corresponding option being set if none of the options from the 
same group was specified. I may combine it with "dependon":

defgroup startup
groupoption "attach" ...
groupoption "init"   ... hidden groupdefault

option "vdb"   dependon="init"
option "temp"  dependon="init"
option "quar"  dependon="init"
...

This way both a) and d) may work but e) fails. What do you think?

I'm not really concerned about how to achieve my main goal.
Any help (including dirty hacks, gengetopt patches) will be appreciated :)



From: Lorenzo Bettini [mailto:address@hidden
> > We were talking about it would be great if groups can be mutually
> > exclusive and one can define default option(s) from a specfic group as
> > if it was declaered at the commandline (in case of any other mutually
> > exlusive option is missing). Something like that?
>
> that's one feature.. then we were discussing of having mutually 
> exclusive groups besides groups of mutually exclusive options.
> 
> However, I'll take a look at the previous emails, since I might not 
> remember well due to my seaside holiday ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]