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

ANSI color support #30

Closed
matkoch opened this issue Mar 1, 2018 · 6 comments
Closed

ANSI color support #30

matkoch opened this issue Mar 1, 2018 · 6 comments
Assignees
Milestone

Comments

@matkoch
Copy link
Member

matkoch commented Mar 1, 2018

Some console hosts and build servers support ANSI color output. One thing to consider is when to enable them. On Windows systems, ANSI colors usually don't work, whereas UNIX terminals support them.

@arodus
Copy link
Contributor

arodus commented Mar 5, 2018

My idea is to check for the TERM environment variable (according to https://stackoverflow.com/a/39033815). If the variable equals xterm-265color the ansi console sink will be used.

@matkoch
Copy link
Member Author

matkoch commented Mar 5, 2018

FYI: TeamCity does support ANSI colors, but doesn't set the TERM environment variable.

@LordMike
Copy link
Contributor

Running stuff in docker could also pose an issue. The container may set TERM (or whatever), but the CLI following along (e.g. Powershell, bash, some CI system) might not.

@arodus
Copy link
Contributor

arodus commented Sep 12, 2018

You are right, do you have any idea how get the information reliable?

@LordMike
Copy link
Contributor

It's probably one long series of guesses that is necessary to get this information.

Nuke already detects certain CI systems / containers - it detected Gitlab for us. This should f.ex. use ANSI colours because Gitlab CI will render it with colours. If the invoking script is powershell, Nuke should use whatever powershell supports.

Running in containers, I don't think it is possible to figure out what the scheme should be - since any number of clients may follow along - but it is at least possible to provide a command switch to override any colour scheme.

E.g. ./build.sh --colors ANSI

In other news, Gitlab (and others) also support a form of "block" or timing capability for logs. https://gitlab.com/gitlab-org/gitlab-ce/issues/14664#note_56006266

If one writes out the following, and end-marker is made at this unix timestamp: Console.WriteLine("section_end:1516815288:test\r" + (char)0x1B + "[0K");

@matkoch matkoch added this to the Backlog milestone Oct 30, 2018
@matkoch matkoch self-assigned this Jan 9, 2019
@matkoch matkoch modified the milestones: Backlog, v0.15.0 Jan 9, 2019
@matkoch matkoch modified the milestones: v0.15.0, v0.16.0 Jan 16, 2019
@matkoch matkoch closed this as completed Jan 29, 2019
@lock
Copy link

lock bot commented Nov 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants