mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[fix] Display colorized messages correctly outside a tty
This commit is contained in:
parent
282ae99cab
commit
1bc6308b3a
1 changed files with 4 additions and 1 deletions
|
@ -31,7 +31,10 @@ def colorize(astr, color):
|
|||
- color -- Name of the color
|
||||
|
||||
"""
|
||||
return '\033[{:d}m\033[1m{:s}\033[m'.format(colors_codes[color], astr)
|
||||
if os.isatty(1):
|
||||
return '\033[{:d}m\033[1m{:s}\033[m'.format(colors_codes[color], astr)
|
||||
else:
|
||||
return astr
|
||||
|
||||
def pretty_print_dict(d, depth=0):
|
||||
"""Print a dictionary recursively
|
||||
|
|
Loading…
Add table
Reference in a new issue