blob: 8212db693f55853163f721e8c5580db1cd1f3170 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package com.woorea.openstack.console.utils;
public class ConsoleUtils {
public static final String RED = "\u001B[31m";
public static final String GREEN = "\u001B[32m";
public static final String YELLOW = "\u001B[33m";
public static final String END = "\u001B[0m";
private StringBuilder sb = new StringBuilder();
public ConsoleUtils append(String text) {
sb.append(text);
return this;
}
public ConsoleUtils red(String text) {
sb.append(ConsoleUtils.RED).append(text).append(END);
return this;
}
public ConsoleUtils green(String text) {
sb.append(ConsoleUtils.GREEN).append(text).append(END);
return this;
}
public ConsoleUtils yellow(String text) {
sb.append(ConsoleUtils.YELLOW).append(text).append(END);
return this;
}
public static void log(String text) {
System.out.println(new ConsoleUtils().yellow("| ").append(text));
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return sb.toString();
}
}
|