help-gengetopt
[Top][All Lists]
Advanced

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

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


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] mutually exclusive group of options
Date: Wed, 13 Jun 2007 00:56:00 +0200
User-agent: Icedove 1.5.0.10 (X11/20070329)

Papp Gyozo (VBuster) wrote:
> Hi
> 
> I've encountered a problem and don't know how to resolve it. I'm developing a 
> commandline tool which can use either of two shared libraries (.so in short) 
> but only one of those at a time. Furthermore, both .so require different 
> options which are available (meaningful) only if the corresponding .so is 
> chosen. For example:
> 
>  scan --init   --dir1=... --dir2=... ; create an own scanning process
> 
> or
> 
>  scan --attach --address=... ; attach to a daemon
> 
> (I hope it is clearer a little bit now what I'm talking about.)
> 
> I know I can specify "init" and "attach" as mutually exclusive group options 
> but I don't know how to induce gengetopt to allow dir options only if --init 
> is given and --address if --attach is given. 
> 
> Any ideas? Thanks in advance
> 

Hi there

you can use the "dependon" specification of an option:

dependon
    this option depends on another option (whose long name description
is specified). If this option is given at command line but not the
option it depends on, an error will be generated.

for instance,

option  "dependant"         D
   "option that depends on str-opt" int optional dependon="str-opt"

does this solve your problem?

hope to hear from you soon
cheers
        Lorenzo

-- 
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
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




reply via email to

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