本文整理了Java中org.sonatype.gshell.util.cli2.Argument
类的一些代码示例,展示了Argument
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Argument
类的具体详情如下:
包路径:org.sonatype.gshell.util.cli2.Argument
类名称:Argument
暂无
代码示例来源:origin: org.sonatype.gshell.commands/gshell-text
/**
* Prints formatted output.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
*
* @since 2.0
*/
@Command(name="printf")
public class PrintfCommand
extends CommandActionSupport
{
@Argument(index=0, required=true)
private String format;
@Argument(index=1, required=true)
private Collection<String> arguments = null;
public Object execute(final CommandContext context) throws Exception {
assert context != null;
IO io = context.getIo();
io.out.printf(format, arguments.toArray());
return Result.SUCCESS;
}
}
代码示例来源: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-util
public int getIndex() {
return spec.index();
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
extends VfsCommandSupport
@Argument(index=0, required=true)
private String sourcePath;
@Argument(index=1, required=true)
private String targetPath;
代码示例来源:origin: org.sonatype.gshell/gshell-util
int index = arg.index();
代码示例来源:origin: org.sonatype.gshell.commands/gshell-logging
@Argument(index=0, required=true)
private String loggerName;
@Argument(index=1, required=true)
private String levelName;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-shell
/**
* Set the return value.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.0
*/
@Command(name="return")
public class ReturnCommand
extends CommandActionSupport
{
@Argument(required=true)
private int result;
public Object execute(final CommandContext context) throws Exception {
assert context != null;
return result;
}
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-standard
/**
* Exit the current shell.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.5
*/
@Command(name="exit")
public class ExitCommand
extends CommandActionSupport
{
@Argument
private int exitCode = 0;
public Object execute(final CommandContext context) throws Exception {
assert context != null;
log.info("Exiting w/code: {}", exitCode);
// Do not call System.exit(), ask the shell to exit instead.
throw new ExitNotification(exitCode);
}
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-shell
/**
* Fail with an exception.
*
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.0
*/
@Command(name="fail")
public class FailCommand
extends CommandActionSupport
{
@Argument
private String message = "Failed";
public Object execute(final CommandContext context) throws Exception {
assert context != null;
IO io = context.getIo();
throw new FailException(message);
}
private static class FailException
extends Exception
{
public FailException(String message) {
super(message);
}
}
}
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
implements VariableNames
@Argument
private String path;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-standard
@Argument(index = 0)
private String name;
@Argument(index = 1)
private List<String> target;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-standard
extends CommandActionSupport
@Argument(required = true)
private int index;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
extends VfsCommandSupport
@Argument(required=true)
private String path;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-vfs
extends VfsCommandSupport
@Argument(required=true)
private String path;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-shell
@Argument(required=true)
private List<String> args;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-shell
extends CommandActionSupport
@Argument(required=true)
private long time;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-shell
private String methodName = "main";
@Argument(index=0, required=true)
private String className;
@Argument(index=1)
private List<String> args;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-standard
@Argument(index = 0, required = true)
private String name;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-file
@Argument(required=true)
private String path;
代码示例来源:origin: org.sonatype.gshell.commands/gshell-file
@Argument(required=true)
private String path;
内容来源于网络,如有侵权,请联系作者删除!