help-gengetopt
[Top][All Lists]
Advanced

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

Re: [help-gengetopt] how to deal with shared parameters for multiple pro


From: Erik Sjölund
Subject: Re: [help-gengetopt] how to deal with shared parameters for multiple programs?
Date: Fri, 2 Mar 2012 19:02:08 +0100

On Sun, Jan 2, 2011 at 5:21 PM, Erik Sjölund <address@hidden> wrote:
> Hi Lorenzo,
>
>> I think a possible solution is to allow a .ggo file to include another one,
>> which is something is still to be implemented in gengetopt...
>
> Yes, I read about the plans. Before that is being implemented it is
> always possible to use
> cmake or some other tool to generate out the .ggo files.

I got an idea.

If in addition to
cmdline_parser (argc, argv, &args_info)
there would also be a
cmdline_parser_allow_unknown_flags(argc, argv, &args_info)

and if there also would be an include directive in gengetopt
configuration files, a program could first let gengetopt parse all the
flags of the program (implemented with includes and
cmdline_parser(argc, argv, &args_info)). After that the program would
run the function cmdline_parser_allow_unknown_flags(argc, argv,
&args_info2) that was generated out of only the common flags.

Advantage: If you have multiple programs that have common flags, you
avoid duplicating code.
Drawbacks: This solution would mean that argv would be parsed twice.
Also group options would be troublesome.

cheers,
Erik Sjölund



reply via email to

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