Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/main/java/org/apache/commons/cli/help/HelpFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
package org.apache.commons.cli.help;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.commons.cli.Option;
Expand Down Expand Up @@ -62,6 +61,21 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*/
public class HelpFormatter extends AbstractHelpFormatter {

/**
* The default "Since" column label.
*/
private static final String LABEL_SINCE = "Since";

/**
* The default "Description" column label.
*/
private static final String LABEL_DESCRIPTION = "Description";

/**
* The default "Options" column label.
*/
private static final String LABEL_OPTIONS = "Options";

/**
* A builder for the HelpFormatter. Intended to make more complex uses of the HelpFormatter class easier. Default values are:
* <ul>
Expand Down Expand Up @@ -184,6 +198,12 @@ public TableDefinition getTableDefinition(final Iterable<Option> options) {
rows.add(row);
});
// return the TableDefinition with the proper column headers.
return TableDefinition.from("", styles, showSince ? Arrays.asList("Options", "Since", "Description") : Arrays.asList("Options", "Description"), rows);
List<String> headers = new ArrayList<>(3);
headers.add(LABEL_OPTIONS);
if (showSince) {
headers.add(LABEL_SINCE);
}
headers.add(LABEL_DESCRIPTION);
return TableDefinition.from("", styles, headers, rows);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ protected TextStyle.Builder resize(final TextStyle.Builder builder, final double
*/
public void setIndent(final int indent) {
textStyleBuilder.setIndent(indent);
// TODO return this in 2.0
}

/**
Expand All @@ -417,6 +418,7 @@ public void setIndent(final int indent) {
*/
public void setLeftPad(final int leftPad) {
textStyleBuilder.setLeftPad(leftPad);
// TODO return this in 2.0
}

/**
Expand All @@ -426,6 +428,7 @@ public void setLeftPad(final int leftPad) {
*/
public void setMaxWidth(final int maxWidth) {
textStyleBuilder.setMaxWidth(maxWidth);
// TODO return this in 2.0
}

/**
Expand Down