List of usage examples for org.apache.commons.cli2.util HelpFormatter printUsage
public void printUsage()
From source file:it.jnrpe.server.console.PluginCommand.java
public String getCommandLine() { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Group g = getCommandLineGroup(); HelpFormatter hf = new HelpFormatter(null, null, null, getConsole().getTerminal().getWidth()); hf.setGroup(g);/* w ww . j a v a 2 s. c o m*/ hf.setPrintWriter(new PrintWriter(new OutputStreamWriter(bout, charset))); hf.printUsage(); String usage = new String(bout.toByteArray(), charset); String[] lines = usage.split("\\n"); StringBuilder res = new StringBuilder(); for (int i = 1; i < lines.length; i++) { res.append(lines[i]); } return res.toString(); }