本文整理汇总了Java中org.apache.commons.cli.Options.addOptionGroup方法的典型用法代码示例。如果您正苦于以下问题:Java Options.addOptionGroup方法的具体用法?Java Options.addOptionGroup怎么用?Java Options.addOptionGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.cli.Options
的用法示例。
在下文中一共展示了Options.addOptionGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOptions
import org.apache.commons.cli.Options; //导入方法依赖的package包/类
private static Options getOptions() {
Options options = new Options();
options.addOption("b", "bind", true,
"Address to bind the Thrift server to. [default: 0.0.0.0]");
options.addOption("p", "port", true, "Port to bind to [default: " + DEFAULT_LISTEN_PORT + "]");
options.addOption("f", "framed", false, "Use framed transport");
options.addOption("c", "compact", false, "Use the compact protocol");
options.addOption("w", "workers", true, "How many worker threads to use.");
options.addOption("h", "help", false, "Print help information");
options.addOption(null, "infoport", true, "Port for web UI");
options.addOption("t", READ_TIMEOUT_OPTION, true,
"Amount of time in milliseconds before a server thread will timeout " +
"waiting for client to send data on a connected socket. Currently, " +
"only applies to TBoundedThreadPoolServer");
OptionGroup servers = new OptionGroup();
servers.addOption(
new Option("nonblocking", false, "Use the TNonblockingServer. This implies the framed transport."));
servers.addOption(new Option("hsha", false, "Use the THsHaServer. This implies the framed transport."));
servers.addOption(new Option("threadpool", false, "Use the TThreadPoolServer. This is the default."));
options.addOptionGroup(servers);
return options;
}
示例2: getCommand
import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Command getCommand() {
return new Command() {
@Override
public String getName() {
return "afs";
}
@Override
public String getTheme() {
return "Application file system";
}
@Override
public String getDescription() {
return "application file system command line tool";
}
@Override
public Options getOptions() {
Options options = new Options();
OptionGroup optionGroup = new OptionGroup();
optionGroup.addOption(Option.builder()
.longOpt(LS)
.desc("list files")
.hasArg()
.optionalArg(true)
.argName("PATH")
.build());
options.addOptionGroup(optionGroup);
return options;
}
@Override
public String getUsageFooter() {
return null;
}
};
}
示例3: populate
import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
void populate(Options options) {
OptionGroup verbosityGroup = new OptionGroup();
verbosityGroup.setRequired(false);
verbosityGroup.addOption(new OptionBuilder("s", "silent").required(false).build());
verbosityGroup.addOption(new OptionBuilder("v", "verbose").required(false).build());
options.addOptionGroup(verbosityGroup);
}