mirror of
https://github.com/rclone/rclone.git
synced 2025-01-24 12:56:36 +02:00
3641993fab
Since rclone version 1.61.0 the tree command uses ANSI color sequences in output by default, but this lead to issues in Windows terminals that were not handling these (#6668). This commit ensures the tree command uses the terminal package for output. It relies on go-colorable to properly handle ANSI color sequences: If stdout is connected to a terminal the escape sequences are decoded and the text are written with color formatting using Windows Console API. If stdout is not connected to a terminal, e.g. redirected to file, the escape sequences are stripped off. The tree command has its own method for writing directly to a file, specified with flag --output, and then the output is not passed through the terminal package and must therefore be written without ansi codes.