Skip to content

Commit 83eddce

Browse files
committed
colors for the terminal
1 parent 3719888 commit 83eddce

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

cassandra/tools/commands.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,25 @@
55
from .config import DRY_RUN
66

77

8-
def call(*args):
8+
def __ansi_color(code):
9+
def inner(text, bold=False):
10+
c = code
11+
if bold:
12+
c = "1;%s" % c
13+
return "\033[%sm%s\033[0m" % (c, text)
14+
return inner
15+
16+
17+
RED = __ansi_color("31")
18+
GREEN = __ansi_color("32")
19+
YELLOW = __ansi_color("33")
20+
BLUE = __ansi_color("34")
21+
MAGENTA = __ansi_color("35")
22+
CYAN = __ansi_color("36")
23+
WHITE = __ansi_color("37")
24+
25+
26+
def call(*args, **kwargs):
927
if DRY_RUN:
1028
logging.info("%s (dry-run)", " ".join(list(args)))
1129
return 0

0 commit comments

Comments
 (0)