use of org.eclipse.ceylon.common.tool.OptionArgumentException.ArgumentMultiplicityException in project ceylon by eclipse.
the class Usage method printUsage.
private void printUsage(OptionArgumentException t) throws Exception {
// which isn't part of the tool API
if (t instanceof UnknownOptionException) {
UnknownOptionException e = (UnknownOptionException) t;
printSynopsis(e.getToolModel());
printOptionSuggestions(e);
} else if (t instanceof OptionMultiplicityException) {
OptionMultiplicityException e = (OptionMultiplicityException) t;
printSynopsis(e.getToolModel());
printOptions(e.getOptionModel().getLongName());
} else if (t instanceof ArgumentMultiplicityException) {
ArgumentMultiplicityException e = (ArgumentMultiplicityException) t;
printSynopsis(e.getToolModel());
} else if (t instanceof OptionWithoutArgumentException) {
OptionWithoutArgumentException e = (OptionWithoutArgumentException) t;
printSynopsis(e.getToolModel());
printOptions(e.getOptionModel().getLongName());
printSuggestions(e.getOptionModel().getArgument().getParser(), null);
} else if (t instanceof InvalidArgumentValueException) {
InvalidArgumentValueException e = (InvalidArgumentValueException) t;
printSynopsis(e.getToolModel());
printSuggestions(e.getArgumentModel().getParser(), e.getBadValue());
} else if (t instanceof InvalidOptionValueException) {
InvalidOptionValueException e = (InvalidOptionValueException) t;
printSynopsis(e.getToolModel());
printOptions(e.getOptionModel().getLongName());
printSuggestions(e.getOptionModel().getArgument().getParser(), e.getBadValue());
} else if (t instanceof ToolInitializationException) {
ToolInitializationException e = (ToolInitializationException) t;
printSynopsis(e.getToolModel());
} else {
printSynopsis(null);
}
printHelpInvocation();
}
Aggregations