Hack to work around an Apache CLI bug, where core arguments couldn't be commingled with walker arguments. These arguments can commingle now. Everybody into the pool.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@252 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-04-01 20:56:42 +00:00
parent 7ce280723f
commit ce57fed2fb
2 changed files with 5 additions and 3 deletions

View File

@ -269,11 +269,10 @@ public class ArgumentParser {
* exit the program
*
* @param args the command line arguments we recieved
* @param args whether to allow incomplete command-line arguments
* @param allowIncomplete whether to allow incomplete command-line arguments
*/
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, !allowIncomplete);
@ -292,7 +291,6 @@ public class ArgumentParser {
// Apache CLI can ignore unrecognized arguments with a boolean flag, but
// you can't get to the unparsed args. Override PosixParser with a class
// that can reach in and extract the protected command line.
// TODO: Holy crap this is wacky. Find a cleaner way.
this.cmd = parser.getCmd();
}

View File

@ -142,6 +142,10 @@ public abstract class CommandLineProgram {
for( Class argumentSource: argumentSources )
clp.addArgumentSource( argumentSource );
clp.m_parser.processArgs(args, false);
// HACK: Load arguments into object again. Apache CLI always stops processing when an option
// is unrecognized, so if core arguments were intermixed with walker arguments, stop processing.
clp.m_parser.loadArgumentsIntoObject( clp );
}
else {
clp.m_parser.processArgs(args, false);