X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fui%2Fstdin%2FCommandReader.java;h=66447b06d9b628a940532f3fe84d31493c41bfcd;hb=5e7f77e44cacc40da04ac9f744566de0710b12a1;hp=e9bcc3ce8af199e61303c7ea8890f54c702c1504;hpb=7cf4d960b265bfa56af6c7abda94eaf00233c6c0;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index e9bcc3c..66447b0 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -63,7 +63,7 @@ public class CommandReader extends AbstractExecutionThreadService { private final BufferedReader reader; /** The writer to write the results to. */ - private final Writer writer; + private final DuplicateLineSuppressingWriter writer; private final Collection failedDownloads; /** @@ -93,6 +93,7 @@ public class CommandReader extends AbstractExecutionThreadService { commandBuilder.add(new FailedDownloadsCommand(failedDownloads)); commandBuilder.add(new RestartCommand(core, failedDownloads)); commandBuilder.add(new ResearchCommand(core)); + commandBuilder.add(new UptimeCommand(core)); commands = commandBuilder.build(); } @@ -110,6 +111,7 @@ public class CommandReader extends AbstractExecutionThreadService { if (line.equals("")) { line = lastLine; } + writer.reset(); String[] words = line.split(" +"); String commandName = words[0]; Collection eligibleCommands = findEligibleCommands(commandName); @@ -121,6 +123,7 @@ public class CommandReader extends AbstractExecutionThreadService { Command command = eligibleCommands.iterator().next(); List parameters = from(asList(words)).skip(1).toList(); state = command.execute(state, parameters, writer); + writer.flush(); } lastLine = line;