mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Handle color on multiple line in a cleaner way
When using ansible deployment on git push, git insert "remote:" at the start of ansible output. If you force the color on ansible, the "remote:" also get colored if the string to display is on more than 1 line. This change make sure that each end of line reset the color, instead of reseting only at the end of the string.
This commit is contained in:
committed by
Matt Clay
parent
5365b81d14
commit
dc71f28642
@@ -70,7 +70,7 @@ def stringc(text, color):
|
||||
"""String in color."""
|
||||
|
||||
if ANSIBLE_COLOR:
|
||||
return u"\033[%sm%s\033[0m" % (codeCodes[color], text)
|
||||
return "\n".join([u"\033[%sm%s\033[0m" % (codeCodes[color], t) for t in text.split('\n')])
|
||||
else:
|
||||
return text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user