mirror of
https://github.com/apache/maven-mvnd.git
synced 2026-01-13 07:04:14 +08:00
Simplify reporting of terminal info
This commit is contained in:
@@ -15,15 +15,11 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.common.logging;
|
||||
|
||||
import org.jline.terminal.Terminal;
|
||||
|
||||
/**
|
||||
* A sink for various kinds of events sent by the daemon.
|
||||
*/
|
||||
public interface ClientOutput extends AutoCloseable {
|
||||
|
||||
Terminal getTerminal();
|
||||
|
||||
void startBuild(String name, int projects, int cores);
|
||||
|
||||
void projectStateChanged(String projectId, String display);
|
||||
@@ -41,4 +37,6 @@ public interface ClientOutput extends AutoCloseable {
|
||||
void display(String projectId, String message);
|
||||
|
||||
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.Terminal;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
import org.jline.terminal.impl.AbstractPosixTerminal;
|
||||
import org.jline.utils.AttributedString;
|
||||
import org.jline.utils.AttributedStringBuilder;
|
||||
import org.jline.utils.AttributedStyle;
|
||||
@@ -138,10 +139,6 @@ public class TerminalOutput implements ClientOutput {
|
||||
this.reader = r;
|
||||
}
|
||||
|
||||
public Terminal getTerminal() {
|
||||
return terminal;
|
||||
}
|
||||
|
||||
public void startBuild(String name, int projects, int cores) {
|
||||
this.name = name;
|
||||
this.totalProjects = projects;
|
||||
@@ -238,6 +235,16 @@ public class TerminalOutput implements ClientOutput {
|
||||
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() {
|
||||
try {
|
||||
while (!closing) {
|
||||
|
||||
Reference in New Issue
Block a user