Search in sources :

Example 1 with Cli

use of io.dropwizard.cli.Cli in project dropwizard by dropwizard.

the class Application method run.

/**
     * Parses command-line arguments and runs the application. Call this method from a {@code public
     * static void main} entry point in your application.
     *
     * @param arguments the command-line arguments
     * @throws Exception if something goes wrong
     */
public void run(String... arguments) throws Exception {
    final Bootstrap<T> bootstrap = new Bootstrap<>(this);
    addDefaultCommands(bootstrap);
    initialize(bootstrap);
    // Should by called after initialize to give an opportunity to set a custom metric registry
    bootstrap.registerMetrics();
    final Cli cli = new Cli(new JarLocation(getClass()), bootstrap, System.out, System.err);
    if (!cli.run(arguments)) {
        // only exit if there's an error running the command
        onFatalError();
    }
}
Also used : Cli(io.dropwizard.cli.Cli) JarLocation(io.dropwizard.util.JarLocation) Bootstrap(io.dropwizard.setup.Bootstrap)

Aggregations

Cli (io.dropwizard.cli.Cli)1 Bootstrap (io.dropwizard.setup.Bootstrap)1 JarLocation (io.dropwizard.util.JarLocation)1