[Top][All Lists]

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

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

From: Papp Gyozo (VBuster)
Subject: Re: [help-gengetopt] mutually exclusive group of options
Date: Thu, 14 Jun 2007 12:27:33 +0200

> So the only solution is to make --init and --attach belong to the same 
> group (so that they're exclusive with each other), and then use dependon
> for all the other options.
> Unfortunately, this requires --init to be specified explicitly (which is
> not what you want...).
> Do you have any proposals of a new mechanism to solve this?

Well a sort of ... but I haven't think it over yet. Let's see what I've already:

We agree that the bottleneck is the obligatory presence of --init option.
What would happen if such a base option (btw how do you call it when other 
options depend on it?) may not be required if it had a default value? (Or 
enabled/switched on by default like "flag on")

defgroup "mode"
groupoption "init"   default="..." group="mode"
groupoption "attach"               group="mode"

option "dir1" dependon="init"
option "dir2" dependon="init"

option "attach-arg" dependon="attach"

This way all below are valid:

  scan --dir1
  scan --dir2
  scan --dir1 --dir2
  scan --init --dir1 --dir2 

but these generate errors in parsing phase:

  scan --init --attach-arg
  scan --attach --dir1
  scan --attach --dir2

What do you think about this?

> Of course, one could perform checks manually, but one would want most of
> the checks to be performed automatically, right? :-)

Of course, I can work around it and I think I'll indeed do that while gengetopt 
comes up with this new feature. I just started to think louldy in the list ...

reply via email to

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