mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-26 15:38:34 +00:00
Simplify reporting of terminal info
This commit is contained in:
@@ -35,8 +35,6 @@ import org.jboss.fuse.mvnd.common.Message.BuildStarted;
|
|||||||
import org.jboss.fuse.mvnd.common.OsUtils;
|
import org.jboss.fuse.mvnd.common.OsUtils;
|
||||||
import org.jboss.fuse.mvnd.common.logging.ClientOutput;
|
import org.jboss.fuse.mvnd.common.logging.ClientOutput;
|
||||||
import org.jboss.fuse.mvnd.common.logging.TerminalOutput;
|
import org.jboss.fuse.mvnd.common.logging.TerminalOutput;
|
||||||
import org.jline.terminal.Terminal;
|
|
||||||
import org.jline.terminal.impl.AbstractPosixTerminal;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -129,13 +127,7 @@ public class DefaultClient implements Client {
|
|||||||
.reset().toString();
|
.reset().toString();
|
||||||
output.accept(null, v);
|
output.accept(null, v);
|
||||||
// Print terminal information
|
// Print terminal information
|
||||||
Terminal terminal = output.getTerminal();
|
output.describeTerminal();
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Terminal: ").append(terminal != null ? terminal.getClass().getName() : null);
|
|
||||||
if (terminal instanceof AbstractPosixTerminal) {
|
|
||||||
sb.append(" with pty ").append(((AbstractPosixTerminal) terminal).getPty().getClass().getName());
|
|
||||||
}
|
|
||||||
output.accept(null, sb.toString());
|
|
||||||
/*
|
/*
|
||||||
* Do not return, rather pass -v to the server so that the client module does not need to depend on any
|
* Do not return, rather pass -v to the server so that the client module does not need to depend on any
|
||||||
* Maven artifacts
|
* Maven artifacts
|
||||||
|
@@ -15,15 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.fuse.mvnd.common.logging;
|
package org.jboss.fuse.mvnd.common.logging;
|
||||||
|
|
||||||
import org.jline.terminal.Terminal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sink for various kinds of events sent by the daemon.
|
* A sink for various kinds of events sent by the daemon.
|
||||||
*/
|
*/
|
||||||
public interface ClientOutput extends AutoCloseable {
|
public interface ClientOutput extends AutoCloseable {
|
||||||
|
|
||||||
Terminal getTerminal();
|
|
||||||
|
|
||||||
void startBuild(String name, int projects, int cores);
|
void startBuild(String name, int projects, int cores);
|
||||||
|
|
||||||
void projectStateChanged(String projectId, String display);
|
void projectStateChanged(String projectId, String display);
|
||||||
@@ -41,4 +37,6 @@ public interface ClientOutput extends AutoCloseable {
|
|||||||
void display(String projectId, String message);
|
void display(String projectId, String message);
|
||||||
|
|
||||||
String prompt(String projectId, String message, boolean password);
|
String prompt(String projectId, String message, boolean password);
|
||||||
|
|
||||||
|
void describeTerminal();
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@ import java.util.stream.Collectors;
|
|||||||
import org.jline.terminal.Size;
|
import org.jline.terminal.Size;
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
import org.jline.terminal.TerminalBuilder;
|
import org.jline.terminal.TerminalBuilder;
|
||||||
|
import org.jline.terminal.impl.AbstractPosixTerminal;
|
||||||
import org.jline.utils.AttributedString;
|
import org.jline.utils.AttributedString;
|
||||||
import org.jline.utils.AttributedStringBuilder;
|
import org.jline.utils.AttributedStringBuilder;
|
||||||
import org.jline.utils.AttributedStyle;
|
import org.jline.utils.AttributedStyle;
|
||||||
@@ -138,10 +139,6 @@ public class TerminalOutput implements ClientOutput {
|
|||||||
this.reader = r;
|
this.reader = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Terminal getTerminal() {
|
|
||||||
return terminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startBuild(String name, int projects, int cores) {
|
public void startBuild(String name, int projects, int cores) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.totalProjects = projects;
|
this.totalProjects = projects;
|
||||||
@@ -238,6 +235,16 @@ public class TerminalOutput implements ClientOutput {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void describeTerminal() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("Terminal: ").append(terminal != null ? terminal.getClass().getName() : null);
|
||||||
|
if (terminal instanceof AbstractPosixTerminal) {
|
||||||
|
sb.append(" with pty ").append(((AbstractPosixTerminal) terminal).getPty().getClass().getName());
|
||||||
|
}
|
||||||
|
this.accept(null, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
void readInputLoop() {
|
void readInputLoop() {
|
||||||
try {
|
try {
|
||||||
while (!closing) {
|
while (!closing) {
|
||||||
|
Reference in New Issue
Block a user