Visitar URL original
Allow control of output colorization by zapo · Pull Request #572 · cli/cli · GitHub
The Wayback Machine - https://web.archive.org/web/20200529203235/https://github.com/cli/cli/pull/572
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

Allow control of output colorization #572

Open
wants to merge 1 commit into
base: trunk
from

Conversation

@zapo
Copy link

zapo commented Mar 3, 2020

Follow up PR based on #447 conversation.

This PR adds two new persistent flags to control colorization:

  • --color=WHEN, with WHEN one of:

    • "auto": current auto-detection of environment behavior, default if omitted
    • "always": force colorization
    • "never": force no-colorization
  • --no-color, disable colorization, equivalent to --color="never" and has precedence over --color

- --color=WHEN, with WHEN one of:
  - "auto": current behavior, default if omitted
  - "always": force colorization
  - "never": force no-colorization
- --no-color, disable colorization, equivalent to --color="never"
@zapo zapo closed this Mar 3, 2020
@zapo
Copy link
Author

zapo commented Mar 3, 2020 •

I realize this doesn't work with latest changes on utils/table_printer.go when output is detected as non-tty and we use instead a tsv table renderer. This doesn't fix my initial problem when using watch.

Is this still the direction you think we should go @mislav ? Should --color=always be a strong enough signal that we are using a tty or should we allow override tty detection with --tty ?
It seems like tty detection is now doing more than coloration only (truncation as well).

@zapo zapo reopened this Mar 3, 2020
@muesli
Copy link
Contributor

muesli commented Mar 4, 2020

Just a quick note: since cli uses glamour for rendering markdown content, we could also enforce/disable its colorization. Let me know if you need some help!

@mislav mislav changed the base branch from master to trunk May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.