You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Sigler, John" <Jo...@sabre.com> on 2003/05/08 20:17:45 UTC
[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