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
Currently click.secho() strips the color information when the output stream is a pipe and not a terminal. With this feature, it will be possible to force click.secho() to preserve the colors even if writing to a pipe. This can be done at several levels and each one of them should work. For example having the functions below, at a global or per stream level. This will allow the parent process to pass the color policy to the subprocess via command line args.
enum ColorPolicy = ALLWAYS_KEEP | ALLWAYS_STRIP | AUTO
# Used at child process.
click.set_color_policy(color_policy: ColorPolicy)
# Used at parent process.
click.get_color_policy() -> ColorPolicy
We have a python program that runs a scons script as a subprocess, captures it's stdout pipe, and sends it to a terminal. When we use ``click.secho() in the subprocess, the colors are removed. This result with the non desire outcome that some our output is colored and similar output that came from the subprocess is not.
I am not aware of a workaround.
The text was updated successfully, but these errors were encountered:
zapta
changed the title
Allow to to emit colored click.secho() messages to a pipeline.
[Feature Request] Allow to to emit colored click.secho() text to a pipeline.
Sep 27, 2024
Currently
click.secho()
strips the color information when the output stream is a pipe and not a terminal. With this feature, it will be possible to forceclick.secho()
to preserve the colors even if writing to a pipe. This can be done at several levels and each one of them should work. For example having the functions below, at a global or per stream level. This will allow the parent process to pass the color policy to the subprocess via command line args.We have a python program that runs a scons script as a subprocess, captures it's stdout pipe, and sends it to a terminal. When we use ``click.secho() in the subprocess, the colors are removed. This result with the non desire outcome that some our output is colored and similar output that came from the subprocess is not.
I am not aware of a workaround.
The text was updated successfully, but these errors were encountered: