Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -o flag for output options for verbosity and raw output #1230

Closed
wants to merge 1 commit into from

Conversation

mgiuffrida
Copy link

Adds the general-purpose -o flag to address #746, with options for
verbosity (#480) and control sequence stripping (#581, #672, #916). Also
provides the ability to enable both verbose and raw output as a
workaround for #1214 without changing the existing verbose behavior.

-o verbose show all command lines while building
-o quiet hide command lines and outputs while building
-o raw never strip control sequences from output
-o strip always strip control sequences from output
-o color strip most control sequences from output, but retain color codes

This patch does not affect Ninja's defaults of normal verbosity and
smart terminal detection for escape sequence stripping.

"-o color" is particularly useful for utilities like head and
less -R that interpret color codes from stdin and pass this colored
output to stdout. Any valid ANSI color code, of the form:

`'ESC' '[' [ colors ] 'm'`

where colors is a semicolon-delimited list of optional integers:

[ n ] [ ';' colors ]

is retained in its entirety when using "-o color" (any other CSI escape
sequences besides ANSI color codes are still stripped for non-smart
terminals).

Adds the general-purpose -o flag to address ninja-build#746, with options for
verbosity (ninja-build#480) and control sequence stripping (ninja-build#581, ninja-build#672, ninja-build#916). Also
provides the ability to enable both verbose and raw output as a
workaround for ninja-build#1214 without changing the existing verbose behavior.

-o verbose  show all command lines while building
-o quiet    hide command lines and outputs while building
-o raw      never strip control sequences from output
-o strip    always strip control sequences from output
-o color    strip most control sequences from output, but retain color codes

This patch does not affect Ninja's defaults of normal verbosity and
smart terminal detection for escape sequence stripping.

"-o color" is particularly useful for utilities like `head` and
`less -R` that interpret color codes from stdin and pass this colored
output to stdout. Any valid ANSI color code, of the form:

    `'ESC' '[' [ colors ] 'm'`

where `colors` is a semicolon-delimited list of optional integers:

   `[ n ] [ ';' colors ]`

is retained in its entirety when using "-o color" (any other CSI escape
sequences besides ANSI color codes are still stripped for non-smart
terminals).
@johandc
Copy link

johandc commented Jul 27, 2017

This is related to pull-request #1268

@jonesmz

This comment was marked as abuse.

@jhasse
Copy link
Collaborator

jhasse commented Aug 4, 2019

I actually want to implement this in a different way (add a dedicated --quiet flag, leave the other options to external tools).

@jhasse jhasse closed this Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants