Search in sources :

Example 1 with CLIResolver

use of hudson.cli.declarative.CLIResolver in project hudson-2.x by hudson.

the class Job method getBuildForCLI.

@CLIResolver
public RunT getBuildForCLI(@Argument(required = true, metaVar = "BUILD#", usage = "Build number") String id) throws CmdLineException {
    try {
        int n = Integer.parseInt(id);
        RunT r = getBuildByNumber(n);
        if (r == null)
            throw new CmdLineException(null, "No such build '#" + n + "' exists");
        return r;
    } catch (NumberFormatException e) {
        throw new CmdLineException(null, id + "is not a number");
    }
}
Also used : ExtensionPoint(hudson.ExtensionPoint) CmdLineException(org.kohsuke.args4j.CmdLineException) CLIResolver(hudson.cli.declarative.CLIResolver)

Aggregations

ExtensionPoint (hudson.ExtensionPoint)1 CLIResolver (hudson.cli.declarative.CLIResolver)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1