From: Colin A. <col...@ho...> - 2007-03-12 09:18:35
|
>From: "Bernd Schoeller" <ber...@in...> >>It seems to me that it would be convenient to be able to set the minimum >>and >>maximum number of parameters expected, which would then reduce the >>checking >>the application had to do. >> >>As the number expected might differ according to the option set, then >>this >>should be settable at the option list level (as well as on the parser, if >>it >>is the same for all (or most) option sets). >> >>What do you think? > >I had already experimented with such a features, but had not full decided >for a satisfactory design. Currently I only differenciate between >mandatory or not mandatory. > >Giving the maximum number of occurencies seems very reasonable. With >minimum: It seems very rare that an option is required 'at least 3 times'. >But I might be wrong here. I will probably extend the mandatory mechanism >to cover such cases. I was not talking about options, but parameters. So the minimum would be the minimum number of parameters that can appear on the command line. By default, zero. And the maximum woudl default to max INTEGER (a practical proxy for infinity). So ls can use the defaults. But many commands would require at least one parameter, and others will require exactly one, or one or two. But it may depend upon the option-set used. For instance, with gexslt, if the --use-pi option is passed, then exactly one parameter is needed (the source document URI or file name). If the --template option is used, then one or two paramters are possible (the transformation URI or file name is mandatory, and the source document is optional). But if neither option is specified, then both of these parameters are compulsory. It would also be nice to be able to name the individual parameters, for use in the error messages that are generated when the wrong number is passed, but that is a further step, I think. _________________________________________________________________ Get Hotmail, News, Sport and Entertainment from MSN on your mobile. http://www.msn.txt4content.com/ |