commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hope, Matthew" <>
Subject RE: [CLI] required options vs. usage
Date Fri, 09 May 2003 07:32:36 GMT
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

Matt Hope

-----Original Message-----
From: Sigler, John [] 
Sent: 08 May 2003 19:18
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


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


To unsubscribe, e-mail:
For additional commands, e-mail:
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.

View raw message