1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Colorize around text (#16415)

Avoid to colorize separately `lead`, equals sign and `num` and separate
them by coloring characters.
This commit is contained in:
Alexandre Garnier 2016-07-24 00:09:20 +02:00 committed by Brian Coca
parent 2b28beb1d7
commit ba2d1d0bc4

View file

@ -78,10 +78,10 @@ def stringc(text, color):
def colorize(lead, num, color):
""" Print 'lead' = 'num' in 'color' """
s = u"%s=%-4s" % (lead, str(num))
if num != 0 and ANSIBLE_COLOR and color is not None:
return u"%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
else:
return u"%s=%-4s" % (lead, str(num))
s = stringc(s, color)
return s
def hostcolor(host, stats, color=True):
if ANSIBLE_COLOR and color: