Skip to content

add option to disable color escapes on stdout #651

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

Closed
nerdralph opened this issue Apr 12, 2020 · 7 comments
Closed

add option to disable color escapes on stdout #651

nerdralph opened this issue Apr 12, 2020 · 7 comments
Labels
conclusion: resolved Issue was resolved topic: CLI Related to the command line interface type: enhancement Proposed improvement

Comments

@nerdralph
Copy link

Bug Report

Current behavior

arduino-cli board details

color escape characters show up on stdout:
Option: MCU mcu
←[32mATtiny13←[0m ←[32m?←[0m ←[32mmcu=t13←[0m

Expected behavior

no escape codes

Environment

  • CLI version (output of arduino-cli version): 0.9.0 Commit: e4d02b4
  • OS and platform: Win7E/mingw32

Additional context

colored output on stdout appears to be hard-coded.

// if we print on stdout, do it in full colors

@rsora rsora added component/CLI type: enhancement Proposed improvement labels Apr 24, 2020
@howjmay
Copy link
Contributor

howjmay commented Jun 13, 2020

Is there a way to reproduce the colored message without Arduino board?

@per1234
Copy link
Contributor

per1234 commented Jun 13, 2020

@howjmay this should do it (the last command produces the color escape output, the first two are just needed to install the arduino:avr platform so that the last command will work):

arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli board details arduino:avr:nano

@howjmay
Copy link
Contributor

howjmay commented Jun 14, 2020

May I try to take this issue. I guess I find the solution for this issue (at least the command listed above). What is the command that can toggle the color?

@howjmay
Copy link
Contributor

howjmay commented Jun 28, 2020

@per1234 @rsora I will add flag --plain in cli/board/details.go and cli/lib/check_deps.go to print plain text instead of color text. What do you guys think?

@matthijskooijman
Copy link
Collaborator

Maybe using --color=[auto|always|never], like many GNU tools support, could be nice for consistency?

E.g. man ls has:

   --color[=WHEN]
         colorize the output; WHEN can be 'always' (default if
         omitted), 'auto', or 'never'; more info below

...

   Using color to distinguish file types is disabled both by default and
   with --color=never.  With --color=auto, ls emits color codes only
   when standard output is connected to a terminal. 

@ubidefeo
Copy link

I'm with @matthijskooijman on this

if we support colour format we should use more legacy-like methods

@per1234 per1234 reopened this Mar 30, 2021
@rsora rsora added topic: CLI Related to the command line interface and removed topic: CLI labels Sep 16, 2021
@umbynos
Copy link
Contributor

umbynos commented Oct 13, 2022

I think we can close this one since we added the flag --no-color in #1418

@umbynos umbynos closed this as completed Oct 13, 2022
@umbynos umbynos added the conclusion: resolved Issue was resolved label Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: CLI Related to the command line interface type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

7 participants