-
Notifications
You must be signed in to change notification settings - Fork 100
/
headers.py
30 lines (25 loc) · 996 Bytes
/
headers.py
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
"""
This file defines the functions needed to render headers that are displayed before each Pulumi project is executed.
These headers provide a useful visual distinction between each step taken to set up an environment.
"""
import logging
import colorize
import env_config_parser
from fart import fart
LOG = logging.getLogger('runner')
FART_FONT = fart.load_font('standard')
banner_type = 'fabulous'
def render_header(text: str, env_config: env_config_parser.EnvConfig):
"""Renders the given text to a header displayed in the console - this header could be large ascii art
:param text: header text to render
:param env_config: reference to environment configuration
"""
global banner_type
if banner_type == 'fabulous':
header = fart.render_fart(text=text, font=FART_FONT)
if not env_config.no_color():
colorize.PRINTLN_FUNC(header)
elif banner_type == 'log':
LOG.info('[%s] started', text)
else:
print(f'* {text}')