use of com.github.rvesse.airline.help.Help in project druid by druid-io.
the class Main method main.
@SuppressWarnings("unchecked")
@SuppressForbidden(reason = "System#out")
public static void main(String[] args) {
final CliBuilder<Runnable> builder = Cli.builder("druid");
builder.withDescription("Druid command-line runner.").withDefaultCommand(Help.class).withCommands(Help.class, Version.class);
List<Class<? extends Runnable>> serverCommands = Arrays.asList(CliCoordinator.class, CliHistorical.class, CliBroker.class, CliOverlord.class, CliIndexer.class, CliMiddleManager.class, CliRouter.class);
builder.withGroup("server").withDescription("Run one of the Druid server types.").withDefaultCommand(Help.class).withCommands(serverCommands);
List<Class<? extends Runnable>> toolCommands = Arrays.asList(DruidJsonValidator.class, PullDependencies.class, CreateTables.class, DumpSegment.class, ResetCluster.class, ValidateSegments.class, ExportMetadata.class);
builder.withGroup("tools").withDescription("Various tools for working with Druid").withDefaultCommand(Help.class).withCommands(toolCommands);
builder.withGroup("index").withDescription("Run indexing for druid").withDefaultCommand(Help.class).withCommands(CliHadoopIndexer.class);
builder.withGroup("internal").withDescription("Processes that Druid runs \"internally\", you should rarely use these directly").withDefaultCommand(Help.class).withCommands(CliPeon.class, CliInternalHadoopIndexer.class);
final Injector injector = GuiceInjectors.makeStartupInjector();
final ExtensionsConfig config = injector.getInstance(ExtensionsConfig.class);
final Collection<CliCommandCreator> extensionCommands = Initialization.getFromExtensions(config, CliCommandCreator.class);
for (CliCommandCreator creator : extensionCommands) {
creator.addCommands(builder);
}
final Cli<Runnable> cli = builder.build();
try {
final Runnable command = cli.parse(args);
if (!(command instanceof Help)) {
// Hack to work around Help not liking being injected
injector.injectMembers(command);
}
command.run();
} catch (ParseException e) {
System.out.println("ERROR!!!!");
System.out.println(e.getMessage());
System.out.println("===");
cli.parse(new String[] { "help" }).run();
System.exit(1);
}
}
Aggregations