/**
 * This file is part of the Harmony package.
 *
 * (c) Mickael Gaillard <mickael.gaillard@tactfactory.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
package com.tactfactory.mda;

import print.color.Ansi.Attribute;
import print.color.Ansi.BColor;
import print.color.Ansi.FColor;
import print.color.ColoredPrinter;

public class ConsoleUtils {
	public static boolean quiet = false;
	public static boolean ansi = true;
	
	private static ColoredPrinter cp = new ColoredPrinter.Builder(0, false).build();
	
	public static void display(String value) {
		if (!quiet)
			if (ansi) {
				cp.println(value);
			} else {
				System.out.println(value);
			}
	}
	
	public static void displayWarning(String value) {
		if (!quiet)
			if (ansi) {
				cp.println("[WARNING]\t" + value + "\n", Attribute.NONE, FColor.YELLOW, BColor.BLACK);
			} else {
				System.out.println(value);
			}
	}
	
	public static void displayDebug(String value) {
		if (!quiet && Harmony.debug)
			if (ansi) {
				cp.println("[DEBUG]\t" + value + "\n", Attribute.NONE, FColor.BLUE, BColor.BLACK);
			} else {
				System.out.println("[DEBUG]\t" + value);
			}
	}
	
	public static void displayError(String value) {
		if (!quiet) 
			if (ansi) {
				cp.println("[ERROR]\t" + value + "\n", Attribute.NONE, FColor.RED, BColor.BLACK);
			} else {
				System.out.println("[ERROR]\t" + value);
			}
	}

	public static void displayLicence(String value) {
		if (!quiet)
			if (ansi) {
				cp.println(value + "\n", Attribute.BOLD, FColor.GREEN, BColor.BLACK);
			} else {
				System.out.println(value);
			}
	}

}

@@ -683,24 +683,40 @@
 tln(value);%0A
+%09%09%09%09cp.clear();%0A
 %09%09%09%7D else %7B%0A
@@ -707,32 +707,32 @@
 ();%0A%09%09%09%7D else %7B%0A
-
 %09%09%09%09System.out.p
@@ -919,32 +919,48 @@
  BColor.BLACK);%0A
+%09%09%09%09cp.clear();%0A
 %09%09%09%7D else %7B%0A%09%09%09%09
@@ -1170,32 +1170,48 @@
  BColor.BLACK);%0A
+%09%09%09%09cp.clear();%0A
 %09%09%09%7D else %7B%0A%09%09%09%09
@@ -1418,32 +1418,48 @@
  BColor.BLACK);%0A
+%09%09%09%09cp.clear();%0A
 %09%09%09%7D else %7B%0A%09%09%09%09
@@ -1580,32 +1580,32 @@
 %0A%09%09%09if (ansi) %7B%0A
-
 %09%09%09%09cp.println(v
@@ -1662,16 +1662,32 @@
 BLACK);%0A
+%09%09%09%09cp.clear();%0A
 %09%09%09%7D els

Fix #1259