Example usage for org.apache.commons.cli2.util HelpFormatter printHelp

List of usage examples for org.apache.commons.cli2.util HelpFormatter printHelp

Introduction

In this page you can find the example usage for org.apache.commons.cli2.util HelpFormatter printHelp.

Prototype

public void printHelp() 

Source Link

Document

Prints detailed help per option.

Usage

From source file:com.ibm.jaql.util.shell.JaqlShellArguments.java

@SuppressWarnings("unchecked")
private static void printHelpAndExit(Exception e, String message, Group options) {
    if (message != null)
        System.err.println(message);
    if (e != null)
        e.printStackTrace();//from ww  w . j a v a 2  s .co m
    HelpFormatter hf = new HelpFormatter();
    hf.setShellCommand("jaqlshell");
    hf.setGroup(options);
    hf.getFullUsageSettings().remove(DisplaySetting.DISPLAY_GROUP_EXPANDED);
    hf.getLineUsageSettings().add(DisplaySetting.DISPLAY_ARGUMENT_BRACKETED);
    hf.print();
    hf.printHelp();
    System.exit(1);
}

From source file:it.jnrpe.server.console.PluginCommand.java

public void printHelp() throws IOException {
    Group g = getCommandLineGroup();

    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    HelpFormatter hf = new HelpFormatter("  ", null, null, getConsole().getTerminal().getWidth());
    hf.setGroup(g);//from  w  w w  .  ja  v  a2  s  . c  o  m

    PrintWriter pw = new PrintWriter(new OutputStreamWriter(bout, charset));
    hf.setPrintWriter(pw);
    hf.printHelp();

    pw.flush();

    // getConsole().println("\u001B[1mCommand Line:\u001B[0m ");
    getConsole().println(highlight("Command Line: "));
    getConsole().println("  " + getName() + " " + getCommandLine());
    getConsole().println(highlight("Usage:"));
    getConsole().println(new String(bout.toByteArray(), charset));

}