in apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java [130:172]
public static ReportConfiguration parseCommands(final File workingDirectory, final String[] args,
final Consumer<Options> helpCmd, final boolean noArgs) throws IOException {
Options opts = buildOptions();
CommandLine commandLine;
try {
commandLine = DefaultParser.builder().setDeprecatedHandler(DeprecationReporter.getLogReporter())
.setAllowPartialMatching(true).build().parse(opts, args);
} catch (ParseException e) {
DefaultLog.getInstance().error(e.getMessage());
DefaultLog.getInstance().error("Please use the \"--help\" option to see a list of valid commands and options.", e);
System.exit(1);
return null; // dummy return (won't be reached) to avoid Eclipse complaint about possible NPE
// for "commandLine"
}
Arg.processLogLevel(commandLine);
ArgumentContext argumentContext = new ArgumentContext(workingDirectory, commandLine);
if (commandLine.hasOption(HELP)) {
helpCmd.accept(opts);
return null;
}
if (commandLine.hasOption(HELP_LICENSES)) {
new Licenses(createConfiguration(argumentContext), new PrintWriter(System.out)).printHelp();
return null;
}
if (commandLine.hasOption(Arg.HELP_LICENSES.option())) {
new Licenses(createConfiguration(argumentContext), new PrintWriter(System.out)).printHelp();
return null;
}
ReportConfiguration configuration = createConfiguration(argumentContext);
if (!noArgs && !configuration.hasSource()) {
String msg = "No directories or files specified for scanning. Did you forget to close a multi-argument option?";
DefaultLog.getInstance().error(msg);
helpCmd.accept(opts);
throw new ConfigurationException(msg);
}
return configuration;
}