Artificial intelligent assistant

How do I preserve coloured output when piping to `less -R`? $ ffmpeg -v debug ... Coloured output. $ ffmpeg -v debug ... |& less -R Dull output. How do I make the output coloured while piping it to something?

For commands that do not have an option similar to `--color=always`, you can do, e.g. with your example:


script -c "ffmpeg -v debug ..." /dev/null < /dev/null |& less -R


What `script` does is that it runs the command in a terminal session.

EDIT: Instead of a command string, if you want to be able to provide an array, then the following zsh wrapper script seems to work:


#!/usr/bin/env zsh
script -c "${${@:q}}" /dev/null < /dev/null |& less -R

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 512bc1933ad57325e810eba5bd7a2a70