Search in sources :

Example 1 with StandardInputReader

use of de.undercouch.underline.StandardInputReader in project georocket by georocket.

the class GeoRocketCli method main.

/**
 * Run the GeoRocket command-line interface
 * @param args the command line arguments
 * @throws IOException if a stream could not be read
 */
public static void main(String[] args) throws IOException {
    // start CLI
    GeoRocketCli cli = new GeoRocketCli();
    cli.setup();
    try {
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out, StandardCharsets.UTF_8));
        cli.setEndHandler(exitCode -> {
            out.flush();
            System.exit(exitCode);
        });
        cli.run(args, new StandardInputReader(), out);
    } catch (OptionParserException e) {
        cli.error(e.getMessage());
        System.exit(1);
    }
}
Also used : OutputStreamWriter(java.io.OutputStreamWriter) OptionParserException(de.undercouch.underline.OptionParserException) StandardInputReader(de.undercouch.underline.StandardInputReader) PrintWriter(java.io.PrintWriter)

Aggregations

OptionParserException (de.undercouch.underline.OptionParserException)1 StandardInputReader (de.undercouch.underline.StandardInputReader)1 OutputStreamWriter (java.io.OutputStreamWriter)1 PrintWriter (java.io.PrintWriter)1