in indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java [122:177]
int execute(String[] args) {
CommandLine cli;
try {
cli = new DefaultParser().parse(buildCliOptions(), cleanArgs(args));
} catch (ParseException e) {
System.err.println("Unable to parse command line options: " + e.getMessage());
displayHelp();
return 1;
}
boolean debug = cli.hasOption(DEBUG);
if (cli.hasOption(HELP)) {
displayHelp();
return 0;
}
if (cli.hasOption(VERSION)) {
showVersion();
return 0;
} else if (debug) {
showVersion();
}
final Module app = Main.wire(BeanScanning.INDEX);
Components components = Guice.createInjector(app).getInstance(Components.class);
if (cli.hasOption(UNPACK)) {
try {
return unpack(cli, components);
} catch (Exception e) {
e.printStackTrace(System.err);
return 1;
}
} else if (cli.hasOption(INDEX) && cli.hasOption(REPO)) {
try {
return index(cli, components);
} catch (Exception e) {
e.printStackTrace(System.err);
return 1;
}
} else {
System.out.println();
System.out.println("Use either unpack (\"" + UNPACK + "\") or index (\"" + INDEX + "\" and \"" + REPO
+ "\") options, but none has been found!");
System.out.println();
displayHelp();
return 1;
}
}