This is an automated email from the ASF dual-hosted git repository. martinkanters pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new 5d6c6e2 [MNG-6915] Format help according to the terminal width 5d6c6e2 is described below commit 5d6c6e2537a6a6b20526766e3a19c027cc454a60 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Thu Jan 21 16:18:04 2021 +0100 [MNG-6915] Format help according to the terminal width --- .../src/main/java/org/apache/maven/cli/CLIManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 4d823a2..a63f366 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -29,6 +29,7 @@ import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; +import org.apache.maven.shared.utils.logging.MessageUtils; /** * @author Jason van Zyl @@ -170,7 +171,13 @@ public class CLIManager HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp( pw, HelpFormatter.DEFAULT_WIDTH, "mvn [options] [<goal(s)>] [<phase(s)>]", + int width = MessageUtils.getTerminalWidth(); + if ( width <= 0 ) + { + width = HelpFormatter.DEFAULT_WIDTH; + } + + formatter.printHelp( pw, width, "mvn [options] [<goal(s)>] [<phase(s)>]", System.lineSeparator() + "Options:", options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, System.lineSeparator(), false );