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

Feature: disable color #13

Open
markand opened this issue Oct 20, 2021 · 5 comments
Open

Feature: disable color #13

markand opened this issue Oct 20, 2021 · 5 comments

Comments

@markand
Copy link

markand commented Oct 20, 2021

I propose a runtime option to disable colors using -c.

@christophercrouzet
Copy link
Owner

Hi @markand, thanks for opening this issue! 😄

I agree, that would be great! Although the way that I was hoping to implement that was through this feature described in the roadmap:

allow choosing the output format of the summary (e.g.: jUnit XML).

Where we'd basically have a choice of options like these (the actual labelling is not definitive):

  • plain
  • colored (default)
  • jUnit XML
  • ...

Otherwise, if a color flag was implemented separately, it might work for some output formats but not others, which might not be ideal.

Would that make sense?

@markand
Copy link
Author

markand commented Oct 22, 2021

Otherwise, if a color flag was implemented separately, it might work for some output formats but not others, which might not be ideal.

I don't think so, for example, the command line tool jq supports coloring the JSON format in the terminal. Basically we could color anything depending on the user choice and export. Just like an editor would color <xml> tags or JSON properties.

I think having an option that disable color should disable them if the output format support them.

@christophercrouzet
Copy link
Owner

I feel like colorizing only makes sense when we want to log output onto a shell for users to consume in a human-friendly fashion, as a way to inform them of the result of running their unit tests.

In contrast, XML, JSON, and other formats are mostly intended to be forwarded onto other commands for further processing rather than being directly consumed by users. In fact, colorizing such outputs would likely make them impossible to be parsed by these other commands.

We should aim at keeping things relevant to the scope of this project and to keep things as simple as possible—Rexo is not a syntax colouring library for XML, JSON, and other formats. If such a feature is needed, I'm sure that there are other commands out there that are built for this specific purpose and that can be piped to the output of Rexo. However, if colorizing the output can help increasing readability of some non-standard output from Rexo that is intended to be consumed by the users, then sure!

As a result, I personally dislike having flags that work only when some other flags have specific values set. I'd rather think of a design that doesn't need this sort of coupling, and that's why I would much prefer what I suggested in my previous comment.

@default-writer
Copy link
Contributor

currently i did not see any colorisation on .devcontainer in vscode for both main and no-asan, so [PASSED] printed out normally. is it expected or just a glitch? i do not understand, thanks!

@christophercrouzet
Copy link
Owner

Hi @default-writer!

Rexo will colorize the output using ANSI escape codes (https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) if:

However, I don't know the specifics of .devcontainer / vscode, sorry 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants