Example usage for org.apache.commons.cli ParseException getMessage

List of usage examples for org.apache.commons.cli ParseException getMessage

Introduction

In this page you can find the example usage for org.apache.commons.cli ParseException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:guru.nidi.raml.doc.Main.java

public static void main(String[] args) {
    System.out.println("RAML doc. Version " + Version.VERSION);
    try {//ww w .  ja  va2 s  .c  o m
        final GeneratorConfig config = new OptionParser().parse(args);
        config.generate();
        System.out.println("Generated Documentation in '" + config.getTarget() + "'");
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        new OptionParser().showHelp();
        System.exit(1);
    } catch (Exception e) {
        System.err.println("Problem generating RAML documentation.");
        e.printStackTrace();
        System.exit(1);
    }
}

From source file:com.wdt.java.ControlTool.java

public static void main(String[] args) {

    Options options = OptionControlClass.OptionControlClass();
    CommandLineParser parser = new GnuParser();
    CommandLine line = null;/*from   w ww  .j  a  v  a 2s .  c  o m*/
    try {
        line = parser.parse(options, args);
    } catch (ParseException e) {
        LOG.log(Level.SEVERE, e.getMessage());
    }
    OptionControlClass.processArgsLogic(line, options);
}

From source file:com.oneops.boo.Main.java

/**
 * The main method./*ww  w .jav a  2 s .  co  m*/
 *
 * @param args the arguments
 */
public static void main(String[] args) {
    BooCli cli = new BooCli();
    int exit = 0;
    try {
        exit = cli.parse(args);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_PARSE_ERROR;
    } catch (BooException e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_BOO;
    } catch (OneOpsClientAPIException e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_CLIENT;
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exit = Constants.EXIT_UNKOWN;
    } finally {
        System.exit(exit);
    }

}

From source file:com.gmarciani.gmparser.GMParser.java

/**
 * <p>The GMParser app main.<p>
 * //  ww w.java  2s  . c om
 * @param args command-line arguments.
 */
public static void main(String[] args) {
    App app = App.getInstance();
    app.printWelcome();
    try {
        app.play(args);
    } catch (ParseException exc) {
        app.getOutput().onWarning(exc.getMessage());
        app.quit();
    }
}

From source file:com.bc.fiduceo.post.PostProcessingToolMain.java

public static void main(String[] args) throws ParseException {
    final CommandLineParser parser = new PosixParser();
    final CommandLine commandLine;
    try {/*from   www. ja v a2 s.c  o m*/
        commandLine = parser.parse(PostProcessingTool.getOptions(), args);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        System.err.println();
        PostProcessingTool.printUsageTo(System.err);
        return;
    }
    if (commandLine.hasOption("h") || commandLine.hasOption("--help")) {
        PostProcessingTool.printUsageTo(System.out);
        return;
    }

    try {
        final PostProcessingContext context = PostProcessingTool.initializeContext(commandLine);
        final PostProcessingTool tool = new PostProcessingTool(context);
        tool.runPostProcessing();
    } catch (Throwable e) {
        FiduceoLogger.getLogger().severe(e.getMessage());
        e.printStackTrace();
        System.exit(-1);
    }
}

From source file:com.soulgalore.crawler.run.CrawlToSystemOut.java

/**
 * Run./*w w w. j  a v  a 2 s  .  c  o  m*/
 * 
 * @param args the args
 */
public static void main(String[] args) {

    try {
        final CrawlToSystemOut crawl = new CrawlToSystemOut(args);
        crawl.crawl();

    } catch (ParseException e) {
        System.err.print(e.getMessage());
    } catch (IllegalArgumentException e) {
        System.err.println(e.getMessage());
    }

}

From source file:de.haber.xmind2latex.Main.java

/**
 * Executes a {@link XMindToLatexExporter} with the given arguments.
 * /*w ww . j  a  v a2  s  . c  o  m*/
 * @param args configuration arguments.
 */
public static void main(String[] args) {
    try {
        XMindToLatexExporter tool = CliParameters.build(args);
        if (tool != null) {
            tool.convert();
        }
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        CliParameters.showHelp();
        System.exit(-1);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        System.exit(-1);
    }
}

From source file:com.jbrisbin.vcloud.cache.Bootstrap.java

public static void main(String[] args) {

    CommandLineParser parser = new BasicParser();
    CommandLine cmdLine = null;//from  w w  w .j a  v  a  2  s  .c  o  m
    try {
        cmdLine = parser.parse(opts, args);
    } catch (ParseException e) {
        log.error(e.getMessage(), e);
    }

    String configFile = "/etc/cloud/async-cache.xml";
    if (null != cmdLine) {
        if (cmdLine.hasOption('c')) {
            configFile = cmdLine.getOptionValue('c');
        }
    }

    ApplicationContext context = new FileSystemXmlApplicationContext(configFile);
    RabbitMQAsyncCacheProvider cacheProvider = context.getBean(RabbitMQAsyncCacheProvider.class);
    while (cacheProvider.isActive()) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            log.error(e.getMessage(), e);
        }
    }

}

From source file:com.adobe.aem.demomachine.Base64Encoder.java

public static void main(String[] args) throws IOException {

    String value = null;/*from ww w.  j  a v  a2  s. c om*/

    // Command line options for this tool
    Options options = new Options();
    options.addOption("v", true, "Value");
    CommandLineParser parser = new BasicParser();
    try {
        CommandLine cmd = parser.parse(options, args);

        if (cmd.hasOption("v")) {
            value = cmd.getOptionValue("v");
        }

        if (value == null) {
            System.out.println("Command line parameters: -v value");
            System.exit(-1);
        }

    } catch (ParseException ex) {

        logger.error(ex.getMessage());

    }

    byte[] encodedBytes = Base64.encodeBase64(value.getBytes());
    System.out.println(new String(encodedBytes));

}

From source file:com.soulgalore.crawler.run.CrawlAndVerifyAssets.java

/**
 * Run./* w w  w . j a  va  2s.c o m*/
 * 
 * @param args the args
 */
public static void main(String[] args) {

    try {
        final CrawlAndVerifyAssets crawl = new CrawlAndVerifyAssets(args);
        crawl.crawl();

    } catch (ParseException e) {
        System.err.print(e.getMessage());
    } catch (IllegalArgumentException e) {
        System.err.println(e.getMessage());
    }

}