Search in sources :

Example 66 with JCommander

use of com.beust.jcommander.JCommander in project gocd by gocd.

the class AgentCLI method printUsageAndExit.

private void printUsageAndExit(int exitCode) {
    StringBuilder out = new StringBuilder();
    JCommander jCommander = new JCommander(new AgentBootstrapperArgs());
    jCommander.setProgramName("java -jar agent-bootstrapper.jar");
    jCommander.usage(out);
    stderr.print(out);
    exit(exitCode);
}
Also used : JCommander(com.beust.jcommander.JCommander)

Example 67 with JCommander

use of com.beust.jcommander.JCommander in project jlineup by otto-de.

the class Main method main.

public static void main(String[] args) throws Exception {
    final Parameters parameters = new Parameters();
    final JCommander jCommander = new JCommander(parameters);
    jCommander.parse(args);
    jCommander.setProgramName("JLineup");
    if (parameters.isHelp()) {
        jCommander.usage();
        System.out.printf("Version: %s%n", Util.getVersion());
        return;
    }
    if (parameters.isVersion()) {
        System.out.printf("JLineup version %s", Util.getVersion());
        return;
    }
    if (parameters.isDebug()) {
        Util.setLogLevelToDebug();
    }
    Config config = null;
    try {
        config = buildConfig(parameters);
    } catch (FileNotFoundException e) {
        System.exit(1);
    }
    if (parameters.isPrintConfig()) {
        System.out.println(Util.createPrettyConfigJson(config));
        System.exit(0);
    }
    JLineupOptions jLineupOptions = new JLineupOptions(parameters);
    JLineup jLineup = new JLineup(config, jLineupOptions);
    int errorLevel = jLineup.run();
    if (errorLevel != 0) {
        System.exit(errorLevel);
    }
}
Also used : Parameters(de.otto.jlineup.config.Parameters) JCommander(com.beust.jcommander.JCommander) Config(de.otto.jlineup.config.Config) FileNotFoundException(java.io.FileNotFoundException)

Example 68 with JCommander

use of com.beust.jcommander.JCommander in project jlineup by otto-de.

the class ScreenshotsComparatorTest method setup.

@Before
public void setup() {
    initMocks(this);
    parameters = new Parameters();
    JCommander jCommander = new JCommander(parameters);
    jCommander.parse("-d", "src/test/resources/");
    config = configBuilder().withUrls(ImmutableMap.of("http://url", new UrlConfig(ImmutableList.of("/"), 0.05f, null, null, null, null, ImmutableList.of(1001), 10000, 2, 0, 0, 0, null, 5))).withWindowHeight(WINDOW_HEIGHT).build();
    testee = new ScreenshotsComparator(parameters, config, fileService, imageService);
}
Also used : Parameters(de.otto.jlineup.config.Parameters) UrlConfig(de.otto.jlineup.config.UrlConfig) JCommander(com.beust.jcommander.JCommander) Before(org.junit.Before)

Aggregations

JCommander (com.beust.jcommander.JCommander)68 ParameterException (com.beust.jcommander.ParameterException)15 IOException (java.io.IOException)10 Map (java.util.Map)6 ParameterDescription (com.beust.jcommander.ParameterDescription)4 File (java.io.File)3 FileInputStream (java.io.FileInputStream)3 Console (com.beust.jcommander.internal.Console)2 DefaultCommand (com.evolveum.midpoint.cli.common.DefaultCommand)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Charsets (com.google.common.base.Charsets)2 Throwables (com.google.common.base.Throwables)2 HostAndPort (com.google.common.net.HostAndPort)2 Service (com.google.common.util.concurrent.Service)2 CreationException (com.google.inject.CreationException)2 SystemException (com.torodb.core.exceptions.SystemException)2 BackendPasswordConfig (com.torodb.packaging.config.model.backend.BackendPasswordConfig)2 AbstractDerby (com.torodb.packaging.config.model.backend.derby.AbstractDerby)2 AbstractPostgres (com.torodb.packaging.config.model.backend.postgres.AbstractPostgres)2 AbstractReplication (com.torodb.packaging.config.model.protocol.mongo.AbstractReplication)2