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

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

Introduction

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

Prototype

public void printHeader() 

Source Link

Document

Prints a header string if necessary

Usage

From source file:broadwick.CliOptions.java

/**
 * Construct and provide GNU-compatible Options. Read the command line extracting the arguments, this
 * additionally displays the help message if the command line is empty.
 *
 * @param args the command line arguments.
 *//*from w w  w  .  j a  v a 2s .c  om*/
public CliOptions(final String[] args) {
    buildCommandLineArguments();

    final Parser parser = new Parser();
    parser.setGroup(options);
    final HelpFormatter hf = new HelpFormatter(SPACE, SPACE, SPACE, LINEWIDTH);
    parser.setHelpFormatter(hf);
    parser.setHelpTrigger("--help");
    cmdLine = parser.parseAndHelp(args);

    if (cmdLine == null) {
        hf.printHeader();
        throw new BroadwickException("Empty command line.");
    }

    validateCommandLineArguments();
}