mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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:
parent
5365b81d14
commit
dc71f28642
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue