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
*
* @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();
Collection<Option> opts = m_options.getOptions();
try {
parser.parse(m_options, args, !allowUnrecognized);
parser.parse(m_options, args, false);
}
catch (UnrecognizedOptionException e) {
// we don't care about unknown exceptions right now
if(!allowUnrecognized) {
catch( ParseException e ) {
boolean isIncomplete = e instanceof MissingArgumentException ||
e instanceof MissingOptionException ||
e instanceof UnrecognizedOptionException;
if( !(allowIncomplete && isIncomplete) ) {
logger.warn(e.getMessage());
throw e;
}