Prints tool help for a given tool
(Tool tool)
| 294 | } |
| 295 | |
| 296 | /** Prints tool help for a given tool */ |
| 297 | public static void printToolHelp(Tool tool) throws IOException { |
| 298 | HelpFormatter formatter = getFormatter(); |
| 299 | Options nonDeprecatedOptions = new Options(); |
| 300 | |
| 301 | tool.getOptions().getOptions().stream() |
| 302 | .filter(option -> !option.isDeprecated()) |
| 303 | .forEach(nonDeprecatedOptions::addOption); |
| 304 | |
| 305 | String usageString = tool.getUsage() == null ? "bin/solr " + tool.getName() : tool.getUsage(); |
| 306 | boolean autoGenerateUsage = tool.getUsage() == null; |
| 307 | formatter.printHelp( |
| 308 | usageString, |
| 309 | "\n" + tool.getHeader(), |
| 310 | nonDeprecatedOptions, |
| 311 | tool.getFooter(), |
| 312 | autoGenerateUsage); |
| 313 | } |
| 314 | |
| 315 | @SuppressForbidden(reason = "System.out for formatting") |
no test coverage detected