On Sun, Jan 2, 2011 at 5:21 PM, Erik Sjölund <erik.sjolund@...> 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.