Compare commits
No commits in common. "f0540a8942cb66f8208068070f0f3947f8339fe6" and "862c164cf3ba09a86016f0bdb53ab88a78fa7891" have entirely different histories.
f0540a8942
...
862c164cf3
@ -12,9 +12,9 @@ import fr.pandacube.lib.util.Log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to hangle general standard IO operation for a CLI application. It uses Jline’s {@link ConsoleReader} for the
|
* Class to hangle general standard IO operation for a CLI application. It uses Jline’s {@link ConsoleReader} for the
|
||||||
* console rendering, a JUL {@link Logger} for logging, and Brigadier to handle commands.
|
* console rendering, a JUL {@link Logger} for logging, and Brigadier for the command management.
|
||||||
*/
|
*/
|
||||||
public class CLI extends Thread {
|
public class CLI {
|
||||||
|
|
||||||
private final ConsoleReader reader;
|
private final ConsoleReader reader;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
@ -25,11 +25,9 @@ public class CLI extends Thread {
|
|||||||
* @throws IOException if an IO error occurs.
|
* @throws IOException if an IO error occurs.
|
||||||
*/
|
*/
|
||||||
public CLI() throws IOException {
|
public CLI() throws IOException {
|
||||||
super("Console Thread");
|
|
||||||
setDaemon(true);
|
|
||||||
|
|
||||||
AnsiConsole.systemInstall();
|
AnsiConsole.systemInstall();
|
||||||
reader = new ConsoleReader();
|
reader = new ConsoleReader();
|
||||||
|
reader.setBellEnabled(false);
|
||||||
reader.setPrompt("\r>");
|
reader.setPrompt("\r>");
|
||||||
reader.addCompleter(CLIBrigadierDispatcher.instance);
|
reader.addCompleter(CLIBrigadierDispatcher.instance);
|
||||||
|
|
||||||
@ -58,9 +56,9 @@ public class CLI extends Thread {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the main loop of the console interface. This method will not return until the input stream is closed.
|
* Runs the main loop of the console interface. This method will not return until the input stream is closed.
|
||||||
|
* Every command will be send to the command handler asynchronously.
|
||||||
*/
|
*/
|
||||||
@Override
|
public void loop() {
|
||||||
public void run() {
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
String line;
|
String line;
|
||||||
|
Loading…
Reference in New Issue
Block a user