io.airlift.airline.ParseOptionMissingException Java Examples

The following examples show how to use io.airlift.airline.ParseOptionMissingException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataCollector.java    From datacollector with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
  Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("cli")
      .withDescription("StreamSets Data Collector CLI")
      .withDefaultCommand(Help.class)
      .withCommands(
          Help.class,
          PingCommand.class
      );

  builder.withGroup("definitions")
      .withDescription("Returns Pipeline & Stage Configuration definitions")
      .withDefaultCommand(DefinitionsCommand.class)
      .withCommands(DefinitionsCommand.class);

  builder.withGroup("store")
      .withDescription("Store Commands")
      .withDefaultCommand(ListPipelinesCommand.class)
      .withCommands(
          ListPipelinesCommand.class,
          ExportPipelineCommand.class,
          ImportPipelineCommand.class,
          CreatePipelineCommand.class,
          GetPipelineConfigCommand.class,
          GetPipelineRulesCommand.class,
          DeletePipelineCommand.class,
          UpdatePipelineConfigCommand.class,
          UpdatePipelineRulesCommand.class,
          DeletePipelinesByFilteringCommand.class
      );

  builder.withGroup("manager")
      .withDescription("Manager Commands")
      .withDefaultCommand(PipelineStatusCommand.class)
      .withCommands(
          PipelineStatusCommand.class,
          PipelineMetricsCommand.class,
          StartPipelineCommand.class,
          StopPipelineCommand.class,
          AlertsCommand.class,
          DeleteAlertCommand.class,
          SampledRecordsCommand.class,
          ResetOriginCommand.class,
          ErrorRecordsCommand.class,
          ErrorMessagesCommand.class,
          SnapshotListCommand.class,
          SnapshotCaptureCommand.class,
          SnapshotStatusCommand.class,
          SnapshotDataCommand.class,
          SnapshotDeleteCommand.class,
          PipelineHistoryCommand.class,
          DeletePipelineHistoryCommand.class,
          GetCommittedOffsetsCommand.class,
          UpdateCommittedOffsetsCommand.class
      );

  builder.withGroup("system")
      .withDescription("System Commands")
      .withDefaultCommand(InfoCommand.class)
      .withCommands(
          ConfigurationCommand.class,
          DirectoriesCommand.class,
          InfoCommand.class,
          CurrentUserCommand.class,
          ServerTimeCommand.class,
          ShutdownCommand.class,
          ThreadsCommand.class,
          EnableDPMCommand.class,
          DisableDPMCommand.class
      );

  builder.withGroup("preview")
      .withDescription("Preview Commands")
      .withDefaultCommand(RunPreviewCommand.class)
      .withCommands(
          RunPreviewCommand.class,
          PreviewStatusCommand.class,
          PreviewDataCommand.class,
          StopPreviewCommand.class,
          ValidatePipelineCommand.class
      );

  try {
    builder.build().parse(args).run();
  } catch (ParseOptionMissingException | ParseArgumentsUnexpectedException ex) {
    if(Arrays.asList(args).contains("--stack")) {
      ex.printStackTrace();
    } else {
      System.out.println(ex.getMessage());
    }
  }

}