From d616b16a772b4ac0c2bf8709e5f895f609581f84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 18 Oct 2013 06:24:52 +0200 Subject: [PATCH] Colourize output. --- src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 01d0051..381c519 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -19,6 +19,9 @@ package net.pterodactylus.xdcc.ui.stdin; import static com.google.common.collect.FluentIterable.from; import static java.util.Arrays.asList; +import static net.pterodactylus.xdcc.ui.stdin.Ansi.bold; +import static net.pterodactylus.xdcc.ui.stdin.Ansi.green; +import static net.pterodactylus.xdcc.ui.stdin.Ansi.red; import static net.pterodactylus.xdcc.ui.stdin.Command.TO_NAME; import java.io.BufferedReader; @@ -131,7 +134,7 @@ public class CommandReader extends AbstractExecutionThreadService { public void downloadStarted(DownloadStarted downloadStarted) { Download download = downloadStarted.download(); try { - writeLine(String.format("Download of %s (from %s, %s) has started.", download.pack().name(), download.bot().name(), download.bot().network().name())); + writeLine(String.format("Download of %s (from %s, %s) has started.", bold(download.pack().name()), download.bot().name(), download.bot().network().name())); } catch (IOException ioe1) { /* ignore. */ } @@ -147,7 +150,7 @@ public class CommandReader extends AbstractExecutionThreadService { public void downloadFinished(DownloadFinished downloadFinished) { Download download = downloadFinished.download(); try { - writeLine(String.format("Download of %s (from %s, %s) has finished, at %s/s.", download.pack().name(), download.bot().name(), download.bot().network().name(), f(download.dccReceiver().overallRate()))); + writeLine(green(String.format("Download of %s (from %s, %s) has finished, at %s/s.", download.pack().name(), download.bot().name(), download.bot().network().name(), f(download.dccReceiver().overallRate())))); } catch (IOException ioe1) { /* ignore. */ } @@ -163,7 +166,7 @@ public class CommandReader extends AbstractExecutionThreadService { public void downloadFailed(DownloadFailed downloadFailed) { Download download = downloadFailed.download(); try { - writeLine(String.format("Download of %s (from %s, %s) has failed at %.1f%% and %s/s.", download.filename(), download.bot().name(), download.bot().network().name(), download.dccReceiver().progress() * 100.0 / download.dccReceiver().size(), f(download.dccReceiver().overallRate()))); + writeLine(red(String.format("Download of %s (from %s, %s) has failed at %.1f%% and %s/s.", download.filename(), download.bot().name(), download.bot().network().name(), download.dccReceiver().progress() * 100.0 / download.dccReceiver().size(), f(download.dccReceiver().overallRate())))); } catch (IOException ioe1) { /* ignore. */ } -- 2.7.4