return builder.withLongName(name).withDescription(desc).create();
}
private void setupOptions(){
final Validator fileValidator = new Validator(){
public void validate(final List values) throws InvalidArgumentException {
// Note : This code doesnt belong here, it should be changed to
// an can exec check in java 6
for (String file : (List<String>)values) {
File f = new File(file);
if ( ! f.exists() ) {
throw new InvalidArgumentException("Argument : " +
f.getAbsolutePath() + " doesn't exist.");
}
if ( ! f.isFile() ) {
throw new InvalidArgumentException("Argument : " +
f.getAbsolutePath() + " is not a file.");
}
if ( ! f.canRead() ) {
throw new InvalidArgumentException("Argument : " +
f.getAbsolutePath() + " is not accessible");
}
}
}
};
// Note: not extending CLI2's FileValidator, that overwrites
// the String arg into File and causes ClassCastException
// in inheritance tree.
final Validator execValidator = new Validator(){
public void validate(final List values) throws InvalidArgumentException {
// Note : This code doesnt belong here, it should be changed to
// an can exec check in java 6
for (String file : (List<String>)values) {
try{