当前位置: 首页>>代码示例>>Java>>正文


Java Cli类代码示例

本文整理汇总了Java中io.airlift.airline.Cli的典型用法代码示例。如果您正苦于以下问题:Java Cli类的具体用法?Java Cli怎么用?Java Cli使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Cli类属于io.airlift.airline包,在下文中一共展示了Cli类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) {
    final Cli.CliBuilder<CollectorCommand> cliBuilder = Cli.<CollectorCommand>builder("graylog-collector")
            .withDescription("Graylog Collector")
            .withDefaultCommand(CollectorHelp.class)
            .withCommand(CollectorHelp.class)
            .withCommand(Version.class)
            .withCommand(Run.class);

    final Cli<CollectorCommand> cli = cliBuilder.build();

    try {
        command = cli.parse(args);
        configureShutdownHook(command);
        command.run();
    } catch (ParseException e) {
        LOG.error(e.getMessage());
        LOG.error("Exit");
    }
}
 
开发者ID:DevOpsStudio,项目名称:Re-Collector,代码行数:20,代码来源:Main.java

示例2: cli

import io.airlift.airline.Cli; //导入依赖的package包/类
private static Cli<Runnable> cli() {
  final CliBuilder<Runnable> builder = Cli.builder("grpc-proxy");

  builder
      .withDescription("A set of example services for testing a gRPC proxy service.")
      .withDefaultCommand(Help.class)
      .withCommand(Help.class)
      .withCommand(HelloWorldClient.Cmd.class);

  builder
      .withGroup("server")
      .withDescription("Run a server")
      .withDefaultCommand(Help.class)
      .withCommand(Help.class)
      .withCommand(ProxyRpcServer.Cmd.class)
      .withCommand(LegacyHttpServer.Cmd.class)
      .withCommand(HelloWorldServer.Cmd.class);

  return builder.build();
}
 
开发者ID:codahale,项目名称:grpc-proxy,代码行数:21,代码来源:Runner.java

示例3: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    @SuppressWarnings("unchecked")
    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("graphql-codegen")
            .withDescription("GraphQL code generator CLI.")
            .withDefaultCommand(Help.class)
            .withCommands(
                    Langs.class,
                    Help.class
            );

    builder.withGroup("generate")
            .withDescription("Generate code in chosen lang")
            .withDefaultCommand(GenerateJava.class)
            .withCommand(GenerateJava.class);

    builder.build().parse(args).run();
}
 
开发者ID:tinnou,项目名称:graphql-codegen,代码行数:18,代码来源:Main.java

示例4: doMain

import io.airlift.airline.Cli; //导入依赖的package包/类
boolean doMain(String[] args) {
  Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("streamsets jks-cs")
      .withDescription("StreamSets Data Collector Java Keystore Credentials Store CLI")
      .withDefaultCommand(Help.class)
      .withCommands(
          Help.class,
          ListCredentialsCommand.class,
          AddCredentialCommand.class,
          DeleteCredentialCommand.class
      );

  try {
    builder.build().parse(args).run();
    return true;
  } catch (Exception ex) {
    if(Arrays.asList(args).contains("--stack")) {
      ex.printStackTrace(System.err);
    } else {
      System.err.println(ex.getMessage());
    }
    return false;
  }
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:24,代码来源:JavaKeystoreCredentialStoreCli.java

示例5: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) {
    CliBuilder<Runnable> builder = Cli.<Runnable> builder("proxy")
        .withDefaultCommand(Help.class)
        .withCommand(Help.class)
        .withCommand(ApnsProxyCommand.class)
        .withCommand(FCMProxyCommand.class);

    builder.build().parse(args).run();
}
 
开发者ID:aerogear,项目名称:push-network-proxies,代码行数:10,代码来源:ProxyCLI.java

示例6: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) {

        String version = Version.readVersionFromResources();
        @SuppressWarnings("unchecked")
        Cli.CliBuilder<Runnable> builder =
                Cli.<Runnable>builder("Swagger-Diff")
                        .withDescription(
                                String.format(
                                        "Swagger Diff CLI (version %s).",
                                        version))
                        .withDefaultCommand(Diff.class)
                        .withCommands(Diff.class, Help.class, Version.class);

        builder.build().parse(args).run();
    }
 
开发者ID:ryandavis84,项目名称:swagger-java-diff-cli,代码行数:16,代码来源:SwaggerDiff.java

示例7: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args)
        throws Throwable
{
    @SuppressWarnings({"unchecked"})
    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("wava")
            .withDescription("WebAssembly for Java")
            .withDefaultCommand(Help.class)
            .withCommands(
                    Help.class,
                    TranslateCommand.class);

    Cli<Runnable> parser = builder.build();
    parser.parse(args).run();
}
 
开发者ID:wrmsr,项目名称:wava,代码行数:15,代码来源:WavaMainCli.java

示例8: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args)
{
    Cli.CliBuilder<Runnable> builder = Cli.<Runnable> builder("alfclient")
            .withDescription("Sample Alfresco Command Line Client").withDefaultCommand(Help.class)
            .withCommands(Help.class, AlfrescoCommands.infoUser.class)
            .withCommands(Help.class, AlfrescoCommands.listRoot.class);

    Cli<Runnable> gitParser = builder.build();

    gitParser.parse(args).run();
}
 
开发者ID:Alfresco,项目名称:alfresco-client-sdk,代码行数:12,代码来源:AlfrescoCLI.java

示例9: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("minijavac")
        .withDescription("A Java compiler for a worse version of Java.")
        .withDefaultCommand(Help.class)
        .withCommands(
            LexCommand.class,
            ParseCommand.class,
            TypecheckCommand.class,
            GenerateCodeCommand.class);
    builder.build().parse(args).run();
}
 
开发者ID:aj-michael,项目名称:minijavac,代码行数:12,代码来源:Minijavac.java

示例10: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) {

    final CliBuilder<Runnable> builder = Cli.builder("jgql");

    builder.withDescription("GraphQL Toolkit");
    builder.withDefaultCommand(Help.class);

    final List<Class<? extends Runnable>> cmds = new LinkedList<>();

    cmds.add(Help.class);

    cmds.add(ExtractSchema.class);
    cmds.add(GenerateClientCode.class);

    cmds.add(RegistryPush.class);
    cmds.add(RegistryGet.class);
    cmds.add(RegistryMonitor.class);
    cmds.add(RunQuery.class);
    cmds.add(Diff.class);
    cmds.add(TestSchema.class);

    builder.withCommands(cmds);

    final Cli<Runnable> parser = builder.build();

    try {
      parser.parse(args).run();
    } catch (final ParseException e) {
      System.err.print(e.getMessage());
      System.err.println(String.format(".  See '%s help'.", self()));
    }

  }
 
开发者ID:zourzouvillys,项目名称:graphql,代码行数:34,代码来源:CommandLineMain.java

示例11: parser

import io.airlift.airline.Cli; //导入依赖的package包/类
private static Cli<TvnLangTool> parser() {
	CliBuilder<TvnLangTool> build = Cli.<TvnLangTool> builder("tavlang")
			.withDescription("Convert, manage workflows")
			.withDefaultCommand(HelpCommand.class)
			.withCommand(CommandConvert.class) // Conversion
			.withCommand(HelpCommand.class) // Help
			.withCommand(CommandInspect.class) // Inspect
			.withCommand(CommandValidate.class) // Validate
			.withCommand(CommandVersion.class) // Version
			.withCommand(CommandStat.class); // Statistics

	return build.build();
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:14,代码来源:CommandLineTool.java

示例12: execute

import io.airlift.airline.Cli; //导入依赖的package包/类
public static Object execute(boolean inputEnabled, File artemisHome, File artemisInstance, ActionContext context, String... args) throws Exception {

      if (inputEnabled) {
         InputAbstract.enableInput();
      }
      try {
         return internalExecute(artemisHome, artemisInstance, args, context);
      } catch (ConfigurationException configException) {
         System.err.println(configException.getMessage());
         System.out.println();
         System.out.println("Configuration should be specified as 'scheme:location'. Default configuration is 'xml:${ARTEMIS_INSTANCE}/etc/bootstrap.xml'");
         return configException;
      } catch (CLIException cliException) {
         System.err.println(cliException.getMessage());
         return cliException;
      } catch (NullPointerException e) {
         // Yeah.. I really meant System.err..
         // this is the CLI and System.out and System.err are common places for interacting with the user
         // this is a programming error that must be visualized and corrected
         e.printStackTrace();
         return e;
      } catch (RuntimeException | InvalidOptionsError re) {
         System.err.println(re.getMessage());
         System.out.println();

         Cli<Action> parser = builder(null).build();

         parser.parse("help").execute(context);
         return re;
      }
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:32,代码来源:Artemis.java

示例13: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) {
    Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("swagger")
            .withDescription("Swagger code generator CLI. More info on swagger.io")
            .withCommands(
                    Generate.class,
                    Help.class
            );

    builder.build().parse(args).run();
}
 
开发者ID:buremba,项目名称:swagger-slate,代码行数:11,代码来源:SlateGenerator.java

示例14: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) {
	Cli<Runnable> parser = createParser();
	
	try {
		
		Runnable command = parser.parse(args);
		command.run();
		
	} catch (ParseException e) {
		System.err.println(e.getMessage());
		System.exit(1);
	}
}
 
开发者ID:pescuma,项目名称:buildhealth,代码行数:14,代码来源:BuildHealthCli.java

示例15: main

import io.airlift.airline.Cli; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
    Cli.<Callable>builder("muckery")
       .withCommands(Help.class, Main.class)
       .withDefaultCommand(Help.class)
       .build()
       .parse(args)
       .call();
}
 
开发者ID:brianm,项目名称:muckery,代码行数:10,代码来源:Main.java


注:本文中的io.airlift.airline.Cli类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。