Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 31597 invoked from network); 24 Oct 2002 15:41:33 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 24 Oct 2002 15:41:33 -0000 Received: (qmail 4552 invoked by uid 97); 24 Oct 2002 15:42:00 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 4490 invoked by uid 97); 24 Oct 2002 15:41:59 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 4452 invoked by uid 50); 24 Oct 2002 15:41:59 -0000 Date: 24 Oct 2002 15:41:59 -0000 Message-ID: <20021024154159.4451.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: commons-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 13935] New: - Request that OptionGroup support setRequired() X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13935 Request that OptionGroup support setRequired() Summary: Request that OptionGroup support setRequired() Product: Commons Version: Nightly Builds Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: CLI AssignedTo: commons-dev@jakarta.apache.org ReportedBy: me@joemcglynn.com As described below, I would like to see OptionGroup support setRequired(), meaning that one and only one of the Options in the OptionGroup must be specified. From a usage perspective this would look something like the following: // create discrete options, these are the main choices // for this program, exactly _ONE_ of these must be specified cmdLineOpts = new Options(); OptionGroup mainOptions = new OptionGroup(); Option generateAll = new Option(OPTION_ALL, OPTION_ALL_LONG, false, OPTION_ALL_HELP); Option generateTarget = new Option(OPTION_TARGET, OPTION_TARGET_LONG, true, OPTION_TARGET_HELP); Option generateLocal = new Option(OPTION_LOCALHOST, OPTION_LOCALHOST_LONG, false, OPTION_LOCALHOST_HELP); Option showHelp = new Option(OPTION_HELP, OPTION_HELP_LONG, false, OPTION_HELP_HELP); // set up a group of mutually-exclusive command line options mainOptions.addOption(generateAll); mainOptions.addOption(generateTarget); mainOptions.addOption(generateLocal); mainOptions.addOption(showHelp); // The following is the enhancement mainOptions.setRequired(); // build options for parsing cmd line cmdLineOpts.addOptionGroup(mainOptions); // etc... > I have a command that has three mutually-exclusive options, of which > _one_ is required. That is my command can: > > command -goleft > command -goright > command -gostraight > > But not: > command > > > How do I represent that one of these three options is required? Seems > like there should be a setRequired() on OptionGroup... > > It also seems like there should be a hierarchy of options, that is > "goleft" can have opta, optb, optc, but "goright can only have optb. -- To unsubscribe, e-mail: For additional commands, e-mail: