Java Code Examples for com.martiansoftware.jsap.FlaggedOption#setRequired()

The following examples show how to use com.martiansoftware.jsap.FlaggedOption#setRequired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LauncherUtils.java    From repairnator with MIT License 5 votes vote down vote up
public static FlaggedOption defineArgOutput(LauncherType launcherType, String helpMessage) {
    FlaggedOption opt = new FlaggedOption("output");
    opt.setShortFlag('o');
    opt.setLongFlag("output");
    // we don't assume the presence of "/tmp" (eg on windows) and the it is writable
    opt.setDefault("./repairnator-output");
    if (launcherType == LauncherType.DOCKERPOOL || launcherType == LauncherType.CHECKBRANCHES) {
        opt.setRequired(true);
    }

    opt.setHelp(helpMessage);

    return opt;
}
 
Example 2
Source File: CheckBranchLauncher.java    From repairnator with MIT License 4 votes vote down vote up
private JSAP defineArgs() throws JSAPException {
    // Verbose output
    JSAP jsap = new JSAP();

    // -h or --help
    jsap.registerParameter(LauncherUtils.defineArgHelp());
    // -d or --debug
    jsap.registerParameter(LauncherUtils.defineArgDebug());
    // --runId
    jsap.registerParameter(LauncherUtils.defineArgRunId());
    // --bears
    jsap.registerParameter(LauncherUtils.defineArgBearsMode());
    // -i or --input
    jsap.registerParameter(LauncherUtils.defineArgBranchInput());
    // -o or --output
    jsap.registerParameter(LauncherUtils.defineArgOutput(LauncherType.CHECKBRANCHES, "Specify where to put output data"));
    // --notifyEndProcess
    jsap.registerParameter(LauncherUtils.defineArgNotifyEndProcess());
    // --smtpServer
    jsap.registerParameter(LauncherUtils.defineArgSmtpServer());
    //--smtpPort
    jsap.registerParameter(LauncherUtils.defineArgSmtpPort());
    //--smtpTLS
    jsap.registerParameter(LauncherUtils.defineArgSmtpTLS());
    // --smtpUsername
    jsap.registerParameter(LauncherUtils.defineArgSmtpUsername());
    // --smtpPassword
    jsap.registerParameter(LauncherUtils.defineArgSmtpPassword());
    // --notifyto
    jsap.registerParameter(LauncherUtils.defineArgNotifyto());
    // -n or --name
    jsap.registerParameter(LauncherUtils.defineArgDockerImageName());
    // --skipDelete
    jsap.registerParameter(LauncherUtils.defineArgSkipDelete());
    // -t or --threads
    jsap.registerParameter(LauncherUtils.defineArgNbThreads());
    // -g or --globalTimeout
    jsap.registerParameter(LauncherUtils.defineArgGlobalTimeout());

    Switch sw1 = new Switch("humanPatch");
    sw1.setShortFlag('p');
    sw1.setLongFlag("humanPatch");
    sw1.setDefault("false");
    jsap.registerParameter(sw1);

    FlaggedOption opt2 = new FlaggedOption("repository");
    opt2.setShortFlag('r');
    opt2.setLongFlag("repository");
    opt2.setStringParser(JSAP.STRING_PARSER);
    opt2.setRequired(true);
    opt2.setHelp("Specify where to collect branches");
    jsap.registerParameter(opt2);

    return jsap;
}