本文整理了Java中org.sonatype.gshell.util.cli2.Option
类的一些代码示例,展示了Option
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option
类的具体详情如下:
包路径:org.sonatype.gshell.util.cli2.Option
类名称:Option
暂无
代码示例来源:origin: org.sonatype.gshell/gshell-core
@Option(name = "h", longName = "help", override=true)
public boolean displayHelp;
代码示例来源:origin: org.sonatype.gshell/gshell-util
assert spec != null;
this.spec = spec;
this.name = UNINITIALIZED_STRING.equals(spec.name()) ? null : spec.name();
this.longName = UNINITIALIZED_STRING.equals(spec.longName()) ? null : spec.longName();
if (spec.args() != UNINITIALIZED) {
args = spec.args();
if (spec.optionalArg()) {
args = 1;
args = spec.args();
optionalArg = spec.optionalArg();
代码示例来源:origin: org.sonatype.gshell/gshell-util
public CliDescriptor(final Object spec, final Setter setter) {
assert spec != null;
assert setter != null;
this.setter = setter;
if (spec instanceof Option) {
Option opt = (Option)spec;
token = UNINITIALIZED_STRING.equals(opt.token()) ? null : opt.token();
required = opt.required();
description = UNINITIALIZED_STRING.equals(opt.description()) ? null : opt.description();
// defaultValue = UNINITIALIZED_STRING.equals(opt.defaultValue()) ? null : opt.defaultValue();
handlerType = Handler.class == opt.handler() ? null : opt.handler();
}
else if (spec instanceof Argument) {
Argument arg = (Argument)spec;
token = UNINITIALIZED_STRING.equals(arg.token()) ? null : arg.token();
required = arg.required();
description = UNINITIALIZED_STRING.equals(arg.description()) ? null : arg.description();
// defaultValue = UNINITIALIZED_STRING.equals(arg.defaultValue()) ? null : arg.defaultValue();
handlerType = Handler.class == arg.handler() ? null : arg.handler();
}
else {
throw new IllegalArgumentException("Invalid spec: " + spec);
}
}
代码示例来源:origin: org.sonatype.gshell/gshell-core
@Option(name = "P", longName = "property")
protected void setSystemProperty(final String input) {
NameValue nv = NameValue.parse(input);
System.setProperty(nv.name, nv.value);
}
代码示例来源:origin: org.sonatype.maven.archetype/archetype-commands
@Option(name = "D", longName="define", args=1)
protected void setProperty(final String input) {
NameValue nv = NameValue.parse(input);
props.setProperty(nv.name, nv.value);
}
代码示例来源:origin: org.sonatype.maven.archetype/archetype-commands
@Option(name = "D", longName="define", args=1)
protected void setProperty(final String input) {
NameValue nv = NameValue.parse(input);
props.setProperty(nv.name, nv.value);
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-logging
@Option(name="n", longName="name")
private String nameQuery;
@Option(name="t", longName="type")
private String typeQuery;
@Option(name="v", longName="verbose")
private boolean verbose;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-logging
@Option(name="n", longName="name")
private String nameQuery;
@Option(name="l", longName="level")
private String levelQuery;
@Option(name="a", longName="all")
private boolean all;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
@Option(name="iname")
private void addiNameFilter(final String name) throws MalformedPatternException {
log.debug("Adding -iname selector for: {}", name);
selector.getSelectors().add(new NameSelector(name, true));
}
代码示例来源:origin: org.sonatype.maven.archetype/archetype-commands
@Option(name = "b", longName="batch")
private boolean batch;
@Option(name = "l", longName="languages", args=1)
private List<String> languages = Constants.DEFAULT_LANGUAGES;
@Option(name="x", longName="filtered-extensions", args=1)
private List<String> filteredExtensions = Constants.DEFAULT_FILTERED_EXTENSIONS;
@Option(name="r", longName="registry", args=1)
private File registryFile;
@Option(name="e", longName="encoding", args=1)
private String encoding = "UTF-8";
@Option(name="R", longName="partial")
private boolean partial;
@Option(name="P", longName="preserve-cdata")
private boolean preserveCDATA;
@Option(name="k", longName="keep-parent")
private boolean keepParent = true;
@Option(name="p", longName="package", args=1)
private String packageName;
@Option(name = "d", longName="directory", args=1)
private File outputDirectory;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
@Option(name="name")
private void addNameFilter(final String name) throws MalformedPatternException {
log.debug("Adding -name selector for: {}", name);
selector.getSelectors().add(new NameSelector(name));
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
@Option(name="type")
private void addTypeFilter(final Type type) {
log.debug("Adding -type selector for: {}", type);
selector.getSelectors().add(new TypeSelector(type));
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-network
/**
* Displays the name of the current host.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.0
*/
@Command(name="hostname")
public class HostnameCommand
extends CommandActionSupport
{
@Option(name="v", longName="verbose")
private boolean verbose;
public Object execute(final CommandContext context) throws Exception {
assert context != null;
IO io = context.getIo();
InetAddress localhost = InetAddress.getLocalHost();
io.println(localhost.getHostName());
if (verbose) {
io.println(localhost.getHostAddress());
}
return Result.SUCCESS;
}
}
代码示例来源:origin: org.sonatype.gshell/gshell-core
@Option(name = "D", longName = "define")
protected void setVariable(final String input) {
NameValue nv = NameValue.parse(input);
vars.set(nv.name, nv.value);
}
代码示例来源:origin: org.sonatype.maven.archetype/archetype-commands
@Option(name = "d", longName="directory", args=1)
private File outputDirectory;
@Option(name = "b", longName="batch")
private boolean batch;
@Option(name = "c", longName="catalog", args=1)
private String catalog = "remote,local";
代码示例来源:origin: org.sonatype.gshell/gshell-core
@Preference(name = "color")
@Option(name = "C", longName = "color")
protected void enableAnsiColors(final Boolean flag) {
Ansi.setEnabled(flag);
}
代码示例来源:origin: org.sonatype.gshell/gshell-core
@Preference(name = "terminal")
@Option(name = "T", longName = "terminal")
protected void setTerminalType(final String type) {
TerminalFactory.configure(type);
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-text
extends VfsCommandSupport
@Option(name = "f")
private boolean caseInsensitive;
@Option(name = "r")
private boolean reverse;
@Option(name = "u")
private boolean unique;
@Option(name = "t")
private String separator;
@Option(name = "b")
private boolean ignoreBlanks;
@Option(name = "k")
private List<String> sortFields;
@Option(name = "n")
private boolean numeric;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
private String path;
@Option(name="l", longName="long")
private boolean longList;
@Option(name="a", longName="all")
private boolean includeHidden;
@Option(name="r", longName="recursive")
private boolean recursive;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-file
private String path;
@Option(name = "l", longName="long")
private boolean longList;
@Option(name = "a", longName="all")
private boolean includeHidden;
@Option(name = "r", longName="recursive")
private boolean recursive;
内容来源于网络,如有侵权,请联系作者删除!