question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add -no-color option

See original GitHub issue

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Please add the option -no-color to cdk.

A lot of users run cdk in a context where the output is not rendered by the system, but instead used for further computation or redirected to other sinks, that cannot interpret terminal formatting. The additional formatting strings makes log reading very difficult. Thank you very much for your work and for your attention. 👍

References

https://www.terraform.io/cli/commands/apply#no-color

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
ansgarmcommented, Jul 13, 2022

Ah, thank you for explaining! Yeah, I’d be cautious about doing a string search for Error: as well. Unfortunately there is no better solution at the moment while still using the CDKTF CLI. That said, you could certainly invoke the Terraform CLI directly in the cdktf.out/stacks/<your-stack> directory and pass the -json option to terraform apply. Depending on the system you are trying to build, this might be worth the effort.

Regarding the color: While FORCE_COLOR disables all the color the CDKTF CLI uses, it still invokes the Terraform CLI under the hood (and redirects its output). Until we support a proper -no-color option you should be able to disable the colored output for the Terraform CLI by additionally setting TF_CLI_ARGS="-no-color".

0reactions
nekhebitcommented, Jul 12, 2022

The output given by cdk is really verbose. It is good for a human to go through it and understand what is going on. It is not so good if you want to output it to a existing logging structure. I would like to either receive a confirmation of success or the error that was generated, without the terraform formatted string/redundant information.

A quick and dirty solution would be to parse the output and search for the Error: string and get the content until the next new line, but everything in me is screaming against it. Maybe there is already an option to get this information without having to resort to this terrible solution. 😁

About the FORCE_COLOR=0: Im still getting color. 😭 Less than before, but still some color:

From pod’s log: error_color

From console with FORCE_COLOR=0 force_color_zero

From console with FORCE_COLOR=1 force_color_one

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add, change, or delete the background color in Word
Add or change the background color · Go to Design > Page Color. · Choose the color you want under Theme Colors or...
Read more >
Solved: No color option in the network printer properties
Click on the Advanced tab. Click on the New Driver button. A new Windows opens with a message saying "Welcome to the Add...
Read more >
Background color for Tk in Python - Stack Overflow
Themed ones tend not to; the background color of a widget is a property of the style/theme there. – Donal Fellows. May 2,...
Read more >
Is there a transparent color(no color) in color panel we can use?
... and Office Supplies, but need a "no color" for Technology. ... It will show as black on the palette, but when you...
Read more >
Ansible Configuration Settings
You can specify a relative path for many configuration options. ... forces color mode even when running without a TTY or the “nocolor”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found