use of org.kohsuke.args4j.CmdLineException in project jangaroo-tools by CoreMedia.
the class PathHandler method parseArguments.
@Override
public int parseArguments(Parameters parameters) throws CmdLineException {
List<File> sourcePathFiles = null;
String sourcePathString = parameters.getParameter(0).trim();
if (!sourcePathString.isEmpty()) {
final String[] sourceDirs = sourcePathString.split("\\Q" + File.pathSeparatorChar + "\\E");
sourcePathFiles = new ArrayList<File>(sourceDirs.length);
for (String sourceDirPath : sourceDirs) {
// be tolerant, accept also '/' as file separator
File sourceDir = new File(sourceDirPath.replace('/', File.separatorChar));
if (!sourceDir.exists()) {
throw new CmdLineException(owner, "directory or file does not exist: " + sourceDir.getAbsolutePath());
}
sourcePathFiles.add(sourceDir);
}
}
if (sourcePathFiles == null) {
sourcePathFiles = new ArrayList<File>();
}
setter.addValue(sourcePathFiles);
return 1;
}
use of org.kohsuke.args4j.CmdLineException in project jangaroo-tools by CoreMedia.
the class SourceFilesHandler method parseArguments.
@Override
public int parseArguments(Parameters parameters) throws CmdLineException {
List<File> sourceFiles = new ArrayList<File>(parameters.size());
for (int i = 0; i < parameters.size(); i++) {
String sourcePath = parameters.getParameter(i);
// be tolerant, accept also '/' as file separator
File sourceFile = new File(sourcePath.replace('/', File.separatorChar));
if (!sourceFile.exists()) {
throw new CmdLineException(owner, "Source file does not exist: " + sourceFile.getAbsolutePath());
}
sourceFiles.add(sourceFile);
}
setter.addValue(sourceFiles);
return parameters.size();
}
use of org.kohsuke.args4j.CmdLineException in project chassis by Kixeye.
the class AppMain method loadArguments.
private static Arguments loadArguments(String[] args) {
Arguments arguments = new Arguments();
CmdLineParser parser = new CmdLineParser(arguments);
parser.setUsageWidth(150);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println();
parser.printUsage(System.err);
return null;
}
if (arguments.help) {
parser.printUsage(System.err);
return null;
}
return arguments;
}
use of org.kohsuke.args4j.CmdLineException in project TrufflePascal by Aspect26.
the class CompilerMain method parseArguments.
private static Settings parseArguments(String[] args) throws CompilerException {
Settings settings = new Settings();
CmdLineParser argumentsParser = new CmdLineParser(settings);
try {
argumentsParser.parseArgument(args);
return settings;
} catch (CmdLineException e) {
throw new WrongOptionsException(e, argumentsParser);
}
}
use of org.kohsuke.args4j.CmdLineException in project asterixdb by apache.
the class LSMExperimentSetRunner method main.
public static void main(String[] args) throws Exception {
// LogManager.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
LSMExperimentSetRunnerConfig config = new LSMExperimentSetRunnerConfig(String.valueOf(System.currentTimeMillis()), 3);
CmdLineParser clp = new CmdLineParser(config);
try {
clp.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
clp.printUsage(System.err);
System.exit(1);
}
Collection<AbstractExperimentBuilder> suite = new ArrayList<>();
/*
suite.add(new Experiment7BBuilder(config));
suite.add(new Experiment7DBuilder(config));
suite.add(new Experiment7ABuilder(config));
suite.add(new Experiment8DBuilder(config));
suite.add(new Experiment8ABuilder(config));
suite.add(new Experiment8BBuilder(config));
suite.add(new Experiment9ABuilder(config));
suite.add(new Experiment9DBuilder(config));
suite.add(new Experiment9BBuilder(config));
suite.add(new Experiment6ABuilder(config));
suite.add(new Experiment6BBuilder(config));
suite.add(new Experiment6CBuilder(config));
suite.add(new Experiment2D1Builder(config));
suite.add(new Experiment2D2Builder(config));
suite.add(new Experiment2D4Builder(config));
suite.add(new Experiment2D8Builder(config));
suite.add(new Experiment2C1Builder(config));
suite.add(new Experiment2C2Builder(config));
suite.add(new Experiment2C4Builder(config));
suite.add(new Experiment2C8Builder(config));
suite.add(new Experiment2A1Builder(config));
suite.add(new Experiment2A2Builder(config));
suite.add(new Experiment2A4Builder(config));
suite.add(new Experiment2A8Builder(config));
suite.add(new Experiment2B1Builder(config));
suite.add(new Experiment2B2Builder(config));
suite.add(new Experiment2B4Builder(config));
suite.add(new Experiment2B8Builder(config));
suite.add(new Experiment1ABuilder(config));
suite.add(new Experiment1BBuilder(config));
suite.add(new Experiment1CBuilder(config));
suite.add(new Experiment1DBuilder(config));
suite.add(new Experiment1EBuilder(config));
suite.add(new Experiment4ABuilder(config));
suite.add(new Experiment4BBuilder(config));
suite.add(new Experiment4CBuilder(config));
suite.add(new Experiment4DBuilder(config));
suite.add(new Experiment3ABuilder(config));
suite.add(new Experiment3BBuilder(config));
suite.add(new Experiment3CBuilder(config));
suite.add(new Experiment3DBuilder(config));
suite.add(new Experiment5ABuilder(config));
suite.add(new Experiment5BBuilder(config));
suite.add(new Experiment5CBuilder(config));
suite.add(new Experiment5DBuilder(config));
*/
suite.add(new PerfTestAggBuilder(config));
suite.add(new PresetClusterPerfBuilder(config));
Pattern p = config.getRegex() == null ? null : Pattern.compile(config.getRegex());
SequentialActionList exps = new SequentialActionList();
for (AbstractExperimentBuilder eb : suite) {
if (p == null || p.matcher(eb.getName()).matches()) {
exps.add(eb.build());
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Added " + eb.getName() + " to run list...");
}
}
}
exps.perform();
}
Aggregations