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

[Suggestion] -no-colors and -start-server #1

Open
vincenzobaz opened this issue Sep 1, 2018 · 3 comments
Open

[Suggestion] -no-colors and -start-server #1

vincenzobaz opened this issue Sep 1, 2018 · 3 comments

Comments

@vincenzobaz
Copy link

I have the necessity to log the output of sbt-client to a text file but the color codes used for the output are not easily readable when not viewed in a terminal.
When I use sbt I can pass the -no-colors options. Using the same option with sbt-client results in an error:

[error] sbt failed to execute our command. Error code: -33000, message: ''`

It would be useful to have this option.
Another nice option would be something like -start-server to tell sbt-client to start the sbt server right away without waiting as it currently does if sbt is not already running.

@antekone
Copy link

antekone commented Jan 7, 2019

Until this option will be implemented by someone, a temporary solution would be to pipe sbt-client's output to this GNU sed rule:

$ sbt-client compile | sed -ur "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"

It will strip the colors from the output, so the output is usable in vim's quickfix window ;).

@cb372
Copy link
Owner

cb372 commented Jan 7, 2019

This is an interesting one, because the -no-colors option has to be passed when you start the sbt server. sbt-client only starts the server if it's not already running, so the behaviour would be different depending on whether the server was already running or was started by sbt-client.

I guess sbt-client could reimplement sbt's -no-colors feature by rewriting the responses from sbt, similar to @antekone's sed command.

@vincenzobaz
Copy link
Author

Thank you @cb372 for answering.
I did not know that the flag had to be set on startup.I do no think that it is a nice I idea to rewrite the output using @antekone 's command in sbt-client. I solved my issue by starting sbt with the flag.

I think that sbt-client should accept a config file or a string or read an environment variable with the flags to pass to sbt upon its startup but it's definitely not a high priority feature.
I do not know any Rust or I'd look into it :(

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