def colour(self, string):
"""
Colours all Stack Statueses in ``string``.
The colours applied are defined in
``sceptre.stack_status_colourer.StackStatusColourer.STACK_STATUS_CODES``
:param string: A string to colour.
:type string: str
:returns: The string with all stack status values coloured.
:rtype: str
"""
stack_statuses = re.findall(self.STACK_STATUS_PATTERN, string)
for status in stack_statuses:
string = re.sub(
r"\b{0}\b".format(status),
"{0}{1}{2}".format(
self.STACK_STATUS_CODES[status], status, Style.RESET_ALL
),
string
)
return string
评论列表
文章目录