bleach
is a command-line utility designed to remove ANSI color codes and other escape sequences from files. It provides an easy way to clean up text files that contain unwanted formatting codes, especially useful for logs or output files generated from scripts and programs.
cargo install --git https://github.com/kojix2/bleach
bleach [options] [file]
-h, --help
: Display the help menu.-i, --in-place
: Edit the file in-place, saving the result to the same file.-b, --backup
: Create a backup of the original file when using the-i
option. The backup file is saved with the.bak
extension.-c, --clean-types [types]
: Specify the types of ANSI sequences to remove:color
,movement
,all
. Defaults toall
if not specified.
- Directly edit a file and remove color codes, creating a backup:
bleach -i -b file.txt
- Remove specific types of ANSI sequences from a file:
bleach -i -c color,movement file.txt
Contributions to bleach
are welcome! Please feel free to submit pull requests or open issues to suggest improvements or report bugs.
This tool was created making full use of ChatGPT and Copilot.
MIT