Print correct help if core arguments (--input-file et al) aren't correctly specified.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@244 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-04-01 15:16:49 +00:00
parent 3af4290a49
commit 7ee792df04
1 changed files with 9 additions and 5 deletions

View File

@ -269,17 +269,21 @@ public class ArgumentParser {
* exit the program * exit the program
* *
* @param args the command line arguments we recieved * @param args the command line arguments we recieved
* @param args whether to allow incomplete command-line arguments
*/ */
public void processArgs(String[] args, boolean allowUnrecognized) throws ParseException { public void processArgs(String[] args, boolean allowIncomplete) throws ParseException {
OurPosixParser parser = new OurPosixParser(); OurPosixParser parser = new OurPosixParser();
Collection<Option> opts = m_options.getOptions(); Collection<Option> opts = m_options.getOptions();
try { try {
parser.parse(m_options, args, !allowUnrecognized); parser.parse(m_options, args, false);
} }
catch (UnrecognizedOptionException e) { catch( ParseException e ) {
// we don't care about unknown exceptions right now boolean isIncomplete = e instanceof MissingArgumentException ||
if(!allowUnrecognized) { e instanceof MissingOptionException ||
e instanceof UnrecognizedOptionException;
if( !(allowIncomplete && isIncomplete) ) {
logger.warn(e.getMessage()); logger.warn(e.getMessage());
throw e; throw e;
} }