mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00: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:
committed by
Brian Coca
parent
2b28beb1d7
commit
ba2d1d0bc4
@@ -78,10 +78,10 @@ def stringc(text, color):
|
|||||||
|
|
||||||
def colorize(lead, num, color):
|
def colorize(lead, num, color):
|
||||||
""" Print 'lead' = 'num' in 'color' """
|
""" Print 'lead' = 'num' in 'color' """
|
||||||
|
s = u"%s=%-4s" % (lead, str(num))
|
||||||
if num != 0 and ANSIBLE_COLOR and color is not None:
|
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))
|
s = stringc(s, color)
|
||||||
else:
|
return s
|
||||||
return u"%s=%-4s" % (lead, str(num))
|
|
||||||
|
|
||||||
def hostcolor(host, stats, color=True):
|
def hostcolor(host, stats, color=True):
|
||||||
if ANSIBLE_COLOR and color:
|
if ANSIBLE_COLOR and color:
|
||||||
|
|||||||
Reference in New Issue
Block a user