Skip to content

-color isn't respected for non-scalac output #1392

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

Open
Gedochao opened this issue Sep 26, 2022 · 3 comments
Open

-color isn't respected for non-scalac output #1392

Gedochao opened this issue Sep 26, 2022 · 3 comments
Labels
bug Something isn't working scalac compatibility Issues tied with compatibility with the scalac (compiler) command. spree

Comments

@Gedochao
Copy link
Contributor

Version(s)
0.1.14

Describe the bug
Passing -O -color is only respected for raw scalac unaltered scala compiler outputs.
It is ignored in all other cases.

To Reproduce

▶ scala-cli -e 'xyz'-O -color -O never                     
Compiling project (Scala 3.2.0, JVM)
[error] snippet:1:13: Not found: xyz
Error compiling project (Scala 3.2.0, JVM)
Compilation failed

The error keyword in the output will be colored red, despite the -O -color -O never

Example for when it is respected

▶ scala-cli -Xshow-phases -O -color -O never
            phase name  description
            ----------  -----------
                parser  scan and parse sources
                 typer  type the trees
      inlinedPositions  check inlined positions

This produces raw scalac output and the -color option is, indeed, respected here.

Expected behaviour
-color should be respected at all times for all scala-cli outputs.
additionally, it shouldn't require passing it through -O

@Gedochao Gedochao added bug Something isn't working SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command. labels Sep 26, 2022
@tgodzik
Copy link
Member

tgodzik commented Nov 14, 2022

This is most likely the same issue as #1285

@Gedochao Gedochao added scalac compatibility Issues tied with compatibility with the scalac (compiler) command. and removed SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command. labels Nov 16, 2022
@Gedochao
Copy link
Contributor Author

Gedochao commented Dec 6, 2022

This is most likely the same issue as #1285

Actually, nope, it is not.
Compiler output colors respect the -color option already.

The problem is that since we now support this option without explicitly stating it after -O (1c78e14), it's easy for the user to assume that the whole of scala-cli should respect this as well - and we do have some colored outputs.

In other words, this ticket is about the coloring of scala-cli outputs alone.

@Gedochao
Copy link
Contributor Author

To implement this, I'd try to modify end outputs in the Logger interface (all our loggers are implementing this, so if we handle coloring there, it should be sufficient):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scalac compatibility Issues tied with compatibility with the scalac (compiler) command. spree
Projects
None yet
Development

No branches or pull requests

2 participants