Example usage for org.apache.commons.cli HelpFormatter setNewLine

List of usage examples for org.apache.commons.cli HelpFormatter setNewLine

Introduction

In this page you can find the example usage for org.apache.commons.cli HelpFormatter setNewLine.

Prototype

public void setNewLine(String newline) 

Source Link

Document

Sets the 'newLine'.

Usage

From source file:org.rhq.server.control.ControlCommand.java

public void printUsage() {
    Options options = getOptions();//from   w  w  w .  j  a  va2s.  com
    HelpFormatter helpFormatter = new HelpFormatter();
    String header = "\n" + getDescription() + "\n\n";
    String syntax;

    if (options.getOptions().isEmpty()) {
        syntax = "rhqctl " + getName();
    } else {
        syntax = "rhqctl " + getName() + " [options]";
    }

    helpFormatter.setNewLine("\n");
    helpFormatter.printHelp(syntax, header, options, null);

    // we can't pass this as the last argument to printHelp above
    // because it throws an exception if the string is too long.
    String readmeContent = getReadmeContent();
    if (readmeContent != null) {
        System.out.println(readmeContent);
    }
}