Matt, Thanks for the info. Of course I had help setup to use the automated help formatter output!
Regards, Neil -----Original Message----- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 12:28 PM To: Jakarta Commons Users List Subject: Re: CLI : OptionBuilder method isRequired() Question On Fri, 2003-06-27 at 12:24, Hainer, Neil wrote: > How can you implement isRequired() for some options but still allow a user to only > enter the option "-h" or "--help" if they want to find out what all the parameters > are of your application. Currently if I just enter the "-h" I get an ParseException > exception because all the required options have not been entered. (This is an answer to this question that appeared on/around May 9th., not from me.) ---------- What you can do is use OptionGroups and make one of either group required (one group contains -h the other the normal usage) In the latest version this functionality results in invalid automated help formatter output. I understand a new version may well be on it's way that does some major rejiggin and fixes this. If you don't care about the auto help then the groups should work fine for parsing. Matt Hope -----Original Message----- From: Sigler, John [mailto:[EMAIL PROTECTED] Sent: 08 May 2003 19:18 To: [EMAIL PROTECTED] Subject: [CLI] required options vs. usage I'd like to set some options as required command line arguments, which are required _except_ when someone wants to see the usage text. That is, the command: foo throws a missing argument exception (and probably prints usage) because there were missing required switches of "-s -f filename" switch. And: foo -s -f file -o -g -l works because -s and -f file match the required options (and the others weren't). And: foo -h prints usage and exits and ignores the required arguments. I'd think this is fairly common but the only way I see to do this is not use required options and handle that logic myself. Am I missing something obvious? john --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
