Roman Huber created CLI-354:
-------------------------------
Summary: HelpFormatter: Description indentation is incorrect
Key: CLI-354
URL: https://issues.apache.org/jira/browse/CLI-354
Project: Commons CLI
Issue Type: Bug
Components: Help formatter
Affects Versions: 1.11.0
Reporter: Roman Huber
When using {{{}HelpFormatter{}}}, the description lines are not indented
consistently.
As an example, I get this output:
{noformat}
-V, --argument-value <value> an argument passed to the remote
command. The value will be wrapped
in double quotes and appended to the
command-line. This option can be
added multiple times.
{noformat}
As shown above, the wrapped description lines are not aligned correctly. Some
lines are indented one space less than others.
h4. Expected behavior
All wrapped description lines should be indented equally, with the exception of
the first line.
h4. Suspected cause
The issue appears to be caused by an incorrect comparison in the indentation
logic. The
[condition|https://github.com/apache/commons-cli/blob/7be3807fa6fd4ad29241074f6ddeb23cfc677775/src/main/java/org/apache/commons/cli/help/TextStyle.java#L372]
currently checks:
{code:java}
restLen > indent
{code}
It should instead be:
{code:java}
restLen >= indent
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)