Skip to content

Automatically disable ANSI escape sequences in Pretty formats if the output is not a terminal. #58363

@alexey-milovidov

Description

@alexey-milovidov

Use case

Writing PrettyCompactNoEscapes is cumbersome.

Describe the solution you'd like

Add a setting output_format_pretty_color with values 0, 1, 'auto'. The default value will be auto.

If it is set to 0, the Pretty formats will not use ANSI escape sequences.
If it is set to 1, the Pretty formats will use ANSI escape sequences, except in cases when it is one of Pretty*NoEscapes formats - they never use escape sequences.
If it is set to auto, the Pretty formats (except Pretty*NoEscapes) will use ANSI escape sequences if stdout is a terminal.

Additional context

For example, Pretty formats over HTTP protocol with the value of output_format_pretty_color set to auto will not use escape sequences.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions