@@ -18,7 +18,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
1818package org .apache .commons .cli .help ;
1919
2020import java .util .ArrayList ;
21- import java .util .Arrays ;
2221import java .util .List ;
2322
2423import org .apache .commons .cli .Option ;
@@ -62,6 +61,21 @@ Licensed to the Apache Software Foundation (ASF) under one or more
6261 */
6362public class HelpFormatter extends AbstractHelpFormatter {
6463
64+ /**
65+ * The default "Since" column label.
66+ */
67+ private static final String LABEL_SINCE = "Since" ;
68+
69+ /**
70+ * The default "Description" column label.
71+ */
72+ private static final String LABEL_DESCRIPTION = "Description" ;
73+
74+ /**
75+ * The default "Options" column label.
76+ */
77+ private static final String LABEL_OPTIONS = "Options" ;
78+
6579 /**
6680 * A builder for the HelpFormatter. Intended to make more complex uses of the HelpFormatter class easier. Default values are:
6781 * <ul>
@@ -184,6 +198,12 @@ public TableDefinition getTableDefinition(final Iterable<Option> options) {
184198 rows .add (row );
185199 });
186200 // return the TableDefinition with the proper column headers.
187- return TableDefinition .from ("" , styles , showSince ? Arrays .asList ("Options" , "Since" , "Description" ) : Arrays .asList ("Options" , "Description" ), rows );
201+ List <String > headers = new ArrayList <>(3 );
202+ headers .add (LABEL_OPTIONS );
203+ if (showSince ) {
204+ headers .add (LABEL_SINCE );
205+ }
206+ headers .add (LABEL_DESCRIPTION );
207+ return TableDefinition .from ("" , styles , headers , rows );
188208 }
189209}
0 commit comments