-
Notifications
You must be signed in to change notification settings - Fork 165
/
Tiltfile
74 lines (49 loc) · 1.13 KB
/
Tiltfile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
RESET='\033[0m'
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[0;37m'
def should_enable_colors():
if 'NO_COLOR' in os.environ:
return False
if 'FORCE_COLOR' in os.environ:
return True
if (config.tilt_subcommand == 'ci' and
(os.getenv('TERM', '') == 'dumb' or os.name == 'nt')):
return False
return True
colors_enabled = should_enable_colors()
def _color(c, value):
if not colors_enabled:
return value
return c + value + RESET
def black(value):
return _color(BLACK, value)
def red(value):
return _color(RED, value)
def green(value):
return _color(GREEN, value)
def yellow(value):
return _color(YELLOW, value)
def blue(value):
return _color(BLUE, value)
def magenta(value):
return _color(MAGENTA, value)
def cyan(value):
return _color(CYAN, value)
def white(value):
return _color(WHITE, value)
color = struct(
black=black,
red=red,
green=green,
yellow=yellow,
blue=blue,
magenta=magenta,
cyan=cyan,
white=white,
)