本文整理汇总了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");
}
}
示例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();
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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()));
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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);
}
}
示例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();
}