-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
terraform needs a way to obviate color everywhere, globally, at once #23708
Comments
Hello @pixleyr! Would using an environment variable work for your use case, and if not, for which use cases does it not? You mentioned that -no-color doesn't work on all commands, so which ones are you still seeing this with? Here's more info on setting the environment variable: https://www.terraform.io/docs/commands/environment-variables.html#tf_cli_args-and-tf_cli_args_name, you would want |
You might consider making |
A growing number of applications support the NO_COLOR environment variable (if present, regardless of value, color output should be disabled) and it'd be nice to add terraform to that list. |
Is the intent of the It seems like there are two use cases here which overlap but are not the same:
I could imagine that in the first category the use of bold and underline to create additional visual hierarchy could still be useful to a sighted user, even if the color rendering is disabled for legibility. But I'm not sure if that true, and even if so I'm not sure if |
I would scope this to the visual accessibility issue as originally reported. If NO_COLOR is to be accepted as the requirements (which seems reasonable), it is scoped to ANSI color output. |
Is there any update on this? NO_COLOR is definitely a rising standard, and would make shutting off colors much easier. Currently, it is incredibly hard to read the Terraform outputs in a terminal that does not support ANSI colors. |
@kflathers-chwy nothing to report, sorry! |
I think there's still some ambiguity here about what's best to do. A relatively easy thing to implement would be for us to treat However, discussion above, and the discussion I see online about the My instinct is to solve the non-terminal-output problem by making Terraform check whether it's writing to a terminal or not using It would then be unnecessary to use either One potential gotcha here is situations where an application is capturing Terraform's output via a pipe but still doing basic interpretation of color codes. I think some web-based automation/CI tools do this, for example: they don't go so far as full terminal emulation and so they don't run programs in a pty, but they do still recognize the basic formatting escape sequences and interpret them. If we did what I described above then Terraform would no longer output colors to such software. Some quick (non-thorough) research gives me the sense that GitHub Actions stdout/stderr is not a tty, in which case this would disable color when running in GitHub Actions, but I've not yet directly tested that. I wonder what other software that tends to run in web-based automation wrappers does to deal with situations like this. Seems worth some further research. 🤔 I also feel tempted to just take the easy way out and make I tried to look for examples of how this decision was made in other software already supporting Terraform uses bold and underline as follows:
That second one in particular is often particularly helpful for understanding an error message and so I'm loathe to just discard it completely, but would be willing to do so if that's what the If anyone following this discussion has direct experience with using the Thanks! |
Confirmed that GitHub Actions do not run in a tty: actions/runner#241 After some further research I've learned about a separate convention of using There's some research here about treatment of I think I was unable to get a good signal on whether folks expect Seems like we need to do some more research here, but I've run out of day for today so unfortunately I have to leave this inconclusive. I'd appreciate any information anyone has about how these various concerns are being treated by comparable software. Note that I'm hoping to achieve consistency with other tools in the space, and not to just choose some particular individual's preference and run with it; I specifically want to avoid implementing something that isn't quite right and then being stuck with never-ending "bug reports" about differences from other software that we can't address without breaking the compatibility promises. 😖 |
The color output makes the output illegible to many people. There needs to be a way to turn it off globally.
I'm aware of the -no-color option on some commands but that's insufficient. I forget. It's too long. it only works on some commands.
I'm also aware of TERM, but I don't want TERM broken. I still use TERM for my curses based apps like vi, emacs, etc.
I just want a way to be able to read the output from terraform.
The text was updated successfully, but these errors were encountered: