/**
* Only called when we know that the last word is an option value
* If endsWithSpace is true we set the value to an empty string to indicate a value
*/
private ParsedCompleteObject findCompleteObjectValue(String line, boolean endsWithSpace) throws CommandLineParserException {
CommandLine cl = parser.parse(line, true);
//the last word is an argument
if(cl.getArgument() != null && !cl.getArgument().getValues().isEmpty()) {
return new ParsedCompleteObject("", endsWithSpace ? "" :
cl.getArgument().getValues().get(cl.getArgument().getValues().size() - 1),
cl.getArgument().getType(), false);
}
//get the last option
else if (cl.getOptions() != null && cl.getOptions().size() > 0) {
ProcessedOption po = cl.getOptions().get(cl.getOptions().size()-1);
//options ends with a separator and thus status should be set accordingly
if(po.getEndsWithSeparator())
endsWithSpace = true;
if(endsWithSpace && po.getValue() != null && po.getValue().length() > 0 &&
(po.getOptionType() == OptionType.NORMAL || po.getOptionType() == OptionType.BOOLEAN)) {
if(cl.getArgument() == null)
return new ParsedCompleteObject(true, "", 0);
else
return new ParsedCompleteObject(true);
}
else if(po.isLongNameUsed() || (po.getShortName() == null || po.getShortName().length() < 1))