You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also it would be swell if jbuilder could call ocamlc/opt with the proper -color on more recent versions. I tried with flags but then it's not dependent on OCaml's version.
One kink is that the run action doesn't seem to preserve colored output for programs it runs. For example, I'm using the Alcotest library for tests which provides nicely colored output for errors, but the colors are discarded if I run the testing binary via jbuilder runtest.
Probably the easiest way to address this is using a global variable in Ansi_color. We just need a way to set term_supports_color if --color is passed. This doesn't seem so clean, so let's see if @jeremiedimino has another idea.
@rgrinberg, @jeremiedimino : Am sorry if am failing to figure out a simple, but allow me add my intuition here.
Well, so as to know the color of the output of the program dune is running, we need to extract it from some file foo, pattern match on it against dune specific colors, then we tag the matched color in dune output.
So if my intuition here is correct, then I think I need more info on how to access file foo.
Let me first clarify how dune handles colors today:
To enable/disable colors in the programs that dune launches (opam, ocaml), dune uses environment variables. See Colors.setup_env_for_colors.
To write color output, dune creates User_message.t values with appropriate styling that are eventually transformed to ansi escape sequences. This conversion is done in Colors.setup_err_formatter_colors
Both of thse code paths fucntion if dune detects that the terminal supports colors. We'd like to create an additional condition for this support to be enabled: whether the user requested colors or not.
Activity
UnixJunkie commentedon Jun 23, 2017
at least I like the default, we are in 2017 ...
c-cube commentedon Jun 25, 2017
Also it would be swell if jbuilder could call ocamlc/opt with the proper
-coloron more recent versions. I tried withflagsbut then it's not dependent on OCaml's version.basus commentedon Jul 18, 2017
One kink is that the
runaction doesn't seem to preserve colored output for programs it runs. For example, I'm using the Alcotest library for tests which provides nicely colored output for errors, but the colors are discarded if I run the testing binary viajbuilder runtest.basus commentedon Jul 19, 2017
@diml that seems to have worked. Thanks!
Use coloured output by default when running INSIDE_DUNE
Use coloured output by default when running INSIDE_DUNE
Use coloured output by default when running INSIDE_DUNE
Use coloured output by default when running INSIDE_DUNE
lubegasimon commentedon Sep 15, 2020
@rgrinberg, @jeremiedimino , could anyone please add some pointer on this issue. Thank you.
rgrinberg commentedon Sep 15, 2020
Probably the easiest way to address this is using a global variable in
Ansi_color. We just need a way to setterm_supports_colorif--coloris passed. This doesn't seem so clean, so let's see if @jeremiedimino has another idea.lubegasimon commentedon Sep 21, 2020
@rgrinberg, @jeremiedimino : Am sorry if am failing to figure out a simple, but allow me add my intuition here.
Well, so as to know the
colorof the output of the program dune is running, we need to extract it from some filefoo, pattern match on it against dune specific colors, then we tag the matched color in dune output.So if my intuition here is correct, then I think I need more info on how to access file
foo.rgrinberg commentedon Sep 22, 2020
Let me first clarify how dune handles colors today:
To enable/disable colors in the programs that dune launches (opam, ocaml), dune uses environment variables. See
Colors.setup_env_for_colors.To write color output, dune creates
User_message.tvalues with appropriate styling that are eventually transformed to ansi escape sequences. This conversion is done inColors.setup_err_formatter_colorsBoth of thse code paths fucntion if dune detects that the terminal supports colors. We'd like to create an additional condition for this support to be enabled: whether the user requested colors or not.
-colorsinstead of setting an env var #2339