Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use full terminal width in CLI with Maven 4 #889

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,16 @@ public int main(
throws Exception {
this.buildEventListener = buildEventListener;
try {
MessageUtils.systemInstall();
MessageUtils.registerShutdownHook();
CliRequest req = new CliRequest(null, null);
req.args = arguments.toArray(new String[0]);
req.workingDirectory = new File(workingDirectory).getCanonicalPath();
req.multiModuleProjectDirectory = new File(projectDirectory);
return doMain(req, clientEnv);
} finally {
this.buildEventListener = BuildEventListener.dummy();
MessageUtils.systemUninstall();
}
}

Expand Down
23 changes: 16 additions & 7 deletions daemon/src/main/java/org/apache/maven/cli/MvndHelpFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import java.util.regex.Pattern;

import org.apache.commons.cli.HelpFormatter;
import org.apache.maven.cli.jansi.MessageUtils;
import org.fusesource.jansi.AnsiConsole;
import org.mvndaemon.mvnd.common.Environment;
import org.mvndaemon.mvnd.common.OptionType;

Expand Down Expand Up @@ -149,13 +151,9 @@ public static String displayHelp(CLIManager cliManager) {
}

private static int getTerminalWidth() {
int terminalWidth;
try {
terminalWidth = Environment.MVND_TERMINAL_WIDTH.asInt();
} catch (Exception e) {
terminalWidth = 80;
}
return terminalWidth;
System.out.println(MessageUtils.getTerminalWidth());
System.out.println(AnsiConsole.isInstalled());
return MessageUtils.getTerminalWidth();
}

private static void indentedLine(StringBuilder stringBuilder, int terminalWidth, String text, String indent) {
Expand Down Expand Up @@ -209,4 +207,15 @@ static StringBuilder spaces(StringBuilder stringBuilder, int count) {
}
return stringBuilder;
}

static {
boolean jansi = true;

try {
Class.forName("org.fusesource.jansi.Ansi");
} catch (ClassNotFoundException var2) {
jansi = false;
}
System.out.println(jansi);
}
}