@Extension public class OfflineNodeCommand extends CLICommand { @Argument(metaVar = "NAME", usage = "Agent name, or empty string for master", required = true, multiValued = true) private List<String> nodes; @Option(name = "-m", usage = "Record the reason about why you are disconnecting this node") public String cause;
public int index() { return base.index()+bias; }
public Class<? extends OptionHandler> handler() { return base.handler(); }
/** * @author Kohsuke Kawaguchi */ @Extension public class GetJobCommand extends CLICommand { @Argument(metaVar="JOB",usage="Name of the job",required=true) public AbstractItem job; @Override public String getShortDescription() { return Messages.GetJobCommand_ShortDescription(); } protected int run() throws Exception { job.writeConfigDotXml(stdout); return 0; } }
/** * {@link CLICommand} that acts on a series of {@link Run}s. * @since 2.62 */ public abstract class RunRangeCommand extends CLICommand { @Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0) public Job<?,?> job; @Argument(metaVar="RANGE",usage="Range of the build records to delete. 'N-M', 'N,M', or 'N'",required=true,index=1) public String range; protected int run() throws Exception { RangeSet rs = RangeSet.fromString(range,false); return act((List)job.getBuilds(rs)); } protected abstract int act(List<Run<?,?>> builds) throws IOException; }
public String metaVar() { return base.metaVar(); }
@Extension public class SetBuildDescriptionCommand extends CLICommand implements Serializable { @Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0) public transient Job<?,?> job; @Argument(metaVar="BUILD#",usage="Number of the build",required=true,index=1) public int number; @Argument(metaVar="DESCRIPTION",required=true,usage="Description to be set. '=' to read from stdin.", index=2) public String description;
@Argument(handler = SubCommandHandler.class, metaVar = "<subCommand>") @SubCommands({@SubCommand(name = "UpdateSegmentState", impl = UpdateSegmentState.class), @SubCommand(name = "AutoAddInvertedIndex", impl = AutoAddInvertedIndexTool.class), @SubCommand(name = "ValidateTableRetention", impl = ValidateTableRetention.class), @SubCommand(name = "PerfBenchmarkRunner", impl = PerfBenchmarkRunner.class), @SubCommand(name = "QueryRunner", impl = QueryRunner.class)}) Command _subCommand; @Option(name = "-help", required = false, help = true, aliases = {"-h", "--h", "--help"}, usage = "Print this message.") boolean _help = false;
/** * {@link CLICommand} that acts on a series of {@link AbstractBuild}s. * * @author Kohsuke Kawaguchi * @deprecated rather use {@link RunRangeCommand} */ @Deprecated public abstract class AbstractBuildRangeCommand extends CLICommand { @Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0) public AbstractProject<?,?> job; @Argument(metaVar="RANGE",usage="Range of the build records to delete. 'N-M', 'N,M', or 'N'",required=true,index=1) public String range; protected int run() throws Exception { RangeSet rs = RangeSet.fromString(range,false); return act((List)job.getBuilds(rs)); } protected abstract int act(List<AbstractBuild<?,?>> builds) throws IOException; }
public String metaVar() { return base.metaVar(); }
@Extension public class DisconnectNodeCommand extends CLICommand { @Argument(metaVar = "NAME", usage = "Slave name, or empty string for master; comma-separated list is supported", required = true, multiValued = true) private List<String> nodes; @Option(name = "-m", usage = "Record the reason about why you are disconnecting this node") public String cause;
/** * @author Kohsuke Kawaguchi */ @Extension public class UpdateJobCommand extends CLICommand { @Argument(metaVar="JOB",usage="Name of the job",required=true) public AbstractItem job; @Override public String getShortDescription() { return Messages.UpdateJobCommand_ShortDescription(); } protected int run() throws Exception { job.updateByXml((Source)new StreamSource(stdin)); return 0; } }
static class Args { @Option(name = "--project-id", aliases = "-p", required = true, usage = "Your GCP project ID") String projectId; @Argument(metaVar = "locationId", required = true, index = 0, usage = "The key location") String locationId; @Argument(metaVar = "keyRingId", required = true, index = 1, usage = "The key ring id") String keyRingId; @Argument(metaVar = "cryptoKeyId", required = true, index = 2, usage = "The crypto key id") String cryptoKeyId; @Argument(metaVar = "inFile", required = true, index = 3, usage = "The source file") String inFile; @Argument(metaVar = "outFile", required = true, index = 4, usage = "The destination file") String outFile; }
@CLIResolver public @CheckForNull Computer getComputer(@Argument(required=true,metaVar="NAME",usage="Node name") @Nonnull String name) { if(name.equals("(master)")) name = ""; for (Computer c : computers.values()) { if(c.getName().equals(name)) return c; } return null; }
/** * Programmatically defines an argument (instead of reading it from annotations as normal). * * @param setter the setter for the type * @param a the Argument * @throws NullPointerException if {@code setter} or {@code a} is {@code null}. */ public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }
public Class<? extends OptionHandler> handler() { return base.handler(); }