/** * Computes the usage of the given {@link CLI}. * * @param builder where the usage is going to be written * @param prefix a prefix to prepend to the usage line. It will be added between 'Usage: ' and the CLI name. * @param cli the cli */ public void usage(StringBuilder builder, String prefix, CLI cli) { computeUsageLine(builder, prefix, cli); if (cli.getSummary() != null && cli.getSummary().trim().length() > 0) { buildWrapped(builder, "\n" + cli.getSummary()); } if (cli.getDescription() != null && cli.getDescription().trim().length() > 0) { buildWrapped(builder, "\n" + cli.getDescription()); } builder.append("\n"); if (cli.getOptions().isEmpty() && cli.getArguments().isEmpty()) { // When we have neither options and arguments, just leave. return; } builder.append("Options and Arguments:\n"); computeOptionsAndArguments(builder, cli.getOptions(), cli.getArguments()); }
/** * Computes the usage of the given {@link CLI}. * * @param builder where the usage is going to be written * @param prefix a prefix to prepend to the usage line. It will be added between 'Usage: ' and the CLI name. * @param cli the cli */ public void usage(StringBuilder builder, String prefix, CLI cli) { computeUsageLine(builder, prefix, cli); if (cli.getSummary() != null && cli.getSummary().trim().length() > 0) { buildWrapped(builder, "\n" + cli.getSummary()); } if (cli.getDescription() != null && cli.getDescription().trim().length() > 0) { buildWrapped(builder, "\n" + cli.getDescription()); } builder.append("\n"); if (cli.getOptions().isEmpty() && cli.getArguments().isEmpty()) { // When we have neither options and arguments, just leave. return; } builder.append("Options and Arguments:\n"); computeOptionsAndArguments(builder, cli.getOptions(), cli.getArguments()); }