X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FANSI.java;h=92a744db21d88a1ed9102e10b9bbb38ca5f6a289;hp=a3304f0e2e413373ab32017b2e1f13efe93c1939;hb=f069d11a0bc59d63b078df8a4aa488498c4e9cc2;hpb=2c05c84a714f54b3bc026f51416492ddb13f33b1 diff --git a/src/edu/berkeley/sbp/util/ANSI.java b/src/edu/berkeley/sbp/util/ANSI.java index a3304f0..92a744d 100644 --- a/src/edu/berkeley/sbp/util/ANSI.java +++ b/src/edu/berkeley/sbp/util/ANSI.java @@ -1,19 +1,17 @@ -// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license +// Copyright 2006-2007 all rights reserved; see LICENSE file for BSD-style license package edu.berkeley.sbp.util; public class ANSI { - //public static String black(Object o) { return "\033[30m"+o+"\033[0m"; } - public static String black(Object o) { return o+""; } - public static String red(Object o) { return "\033[31m"+o+"\033[0m"; } - //public static String red(Object o) { return o+""; } - //public static String green(Object o) { return "\033[32m"+o+"\033[0m"; } - public static String green(Object o) { return o+""; } - //public static String yellow(Object o) { return "\033[33m"+o+"\033[0m"; } - public static String yellow(Object o) { return o+""; } - //public static String blue(Object o) { return "\033[34m"+o+"\033[0m"; } - public static String blue(Object o) { return o+""; } - //public static String purple(Object o) { return "\033[35m"+o+"\033[0m"; } - public static String purple(Object o) { return o+""; } - //public static String cyan(Object o) { return "\033[36m"+o+"\033[0m"; } - public static String cyan(Object o) { return o+""; } + private static final boolean disable = + !"true".equals(System.getProperty("sbp.color", "true")); + public static String black(Object o) { if (disable) return o+""; return o+""; } + public static String red(Object o) { if (disable) return o+""; return "\033[31m"+o+"\033[0m"; } + public static String green(Object o) { if (disable) return o+""; return "\033[32m"+o+"\033[0m"; } + public static String yellow(Object o) { if (disable) return o+""; return "\033[33m"+o+"\033[0m"; } + public static String blue(Object o) { if (disable) return o+""; return "\033[34m"+o+"\033[0m"; } + public static String purple(Object o) { if (disable) return o+""; return "\033[35m"+o+"\033[0m"; } + public static String cyan(Object o) { if (disable) return o+""; return "\033[36m"+o+"\033[0m"; } + public static String invert(Object o) { if (disable) return o+""; return "\033[7m"+o+"\033[0m"; } + public static String bold(Object o) { if (disable) return o+""; return "\033[1m"+o+"\033[0m"; } + public static String clreol() { return "\033[0K"; } }