Re: Ambiguity elimination by using both command line options and configuration file
Lorenzo Bettini <[email protected]>
| Newsgroups | gmane.comp.gnu.gengetopt.general |
|---|---|
| Message-ID | <[email protected]> |
Yegor Yefremov wrote: > Dear list, > > I have following situation: > I have both command line parameters and configuration file and I want > prevent defining the same option in both command line and configuration > file. At first I parse the command line options to obtain the configfile > file name and then I parse the configfile. When I define the option in > both I don't get any error. The program can check if I defined two > options in the same command line but it can't check it if I defined them > both in command line and configuration file due to the fact, that only > local_args_info will be checked. I think it is important issue to reduce > debugging overhead when operating with both command line and > configuration file. Hi there as you proposed in a previous private email, one solution could be to add a command line option -C|--conf-parser-noambiguity in order to make the parser check for these ambiguities... another solution might be to use different args_info structures for parsing the configuration file and the command line and use a function generated by gengetopt, e.g., check_dup (similar to the check_required generated function) that checks that non multiple options are not specified in both structures, what do you think? This would avoid overwhelming the parser function with many parameters... or did you mean that, when --conf-parser-noambiguity is specified and override is 0 when passed to the parser function, then a duplicate would generate an error? Did you mean that --conf-parser-noambiguity should be a command line option or a gengetopt's command line option? 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