Currently, if using options that colorize the output, distribution doesn't player super nicely when piping its output to another command, or redirecting it to a file, due to the the shell escape sequences used for colorizing the output.
For example, if your default options have color enabled, and you redirect the output to a file, opening that file in a text editor results in something like this (note all of the escape sequences):
342191L:25�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:24�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:23�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:22�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:21�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:20�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:19�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:18�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:17�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:16�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:15�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:14�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:13�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:12�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
342191L:11�[0m|�[32m1 �[35m(3.85%) �[34m█████████████████████▏�[0m
I propose extending the --color option to have three options, always, never, and auto, similar to POSIX tools like grep and ls. The auto option detects whether the output is a terminal, and only enables color if so.
Currently, if using options that colorize the output,
distributiondoesn't player super nicely when piping its output to another command, or redirecting it to a file, due to the the shell escape sequences used for colorizing the output.For example, if your default options have color enabled, and you redirect the output to a file, opening that file in a text editor results in something like this (note all of the escape sequences):
I propose extending the
--coloroption to have three options,always,never, andauto, similar to POSIX tools likegrepandls. Theautooption detects whether the output is a terminal, and only enables color if so.