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:
parent
3af4290a49
commit
7ee792df04
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue