mirror of https://github.com/docker/compose.git
Remove all colors in output when --no-ansi is set
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
9e88b15172
commit
60eed707d1
|
@ -97,8 +97,10 @@ def dispatch():
|
||||||
{'options_first': True, 'version': get_version_info('compose')})
|
{'options_first': True, 'version': get_version_info('compose')})
|
||||||
|
|
||||||
options, handler, command_options = dispatcher.parse(sys.argv[1:])
|
options, handler, command_options = dispatcher.parse(sys.argv[1:])
|
||||||
setup_console_handler(console_handler, options.get('--verbose'))
|
setup_console_handler(console_handler, options.get('--verbose'), options.get('--no-ansi'))
|
||||||
setup_parallel_logger(options.get('--no-ansi'))
|
setup_parallel_logger(options.get('--no-ansi'))
|
||||||
|
if options.get('--no-ansi'):
|
||||||
|
command_options['--no-color'] = True
|
||||||
return functools.partial(perform_command, options, handler, command_options)
|
return functools.partial(perform_command, options, handler, command_options)
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,8 +136,8 @@ def setup_parallel_logger(noansi):
|
||||||
compose.parallel.ParallelStreamWriter.set_noansi()
|
compose.parallel.ParallelStreamWriter.set_noansi()
|
||||||
|
|
||||||
|
|
||||||
def setup_console_handler(handler, verbose):
|
def setup_console_handler(handler, verbose, noansi=False):
|
||||||
if handler.stream.isatty():
|
if handler.stream.isatty() and noansi is False:
|
||||||
format_class = ConsoleWarningFormatter
|
format_class = ConsoleWarningFormatter
|
||||||
else:
|
else:
|
||||||
format_class = logging.Formatter
|
format_class = logging.Formatter
|
||||||
|
|
Loading…
Reference in New Issue