- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2k
Description
Describe the bug
This is the root cause of #14043.
In (unrelated to 14043) digging around in the ansi command, it comes to mind that the reason why user-land ANSI was still coloring output in #14043 is that the ansi command itself still outputs color codes, even when use_ansi_coloring is false.
This shouldn't happen.
The ansi command actually checks the use_ansi_coloring option, but only to determine if color previews should be shown with ansi --list/-l.  It should also check before outputting a color (or attribute) code.
How to reproduce
Note: to reproduce correctly, each line of the following must be executed separately; otherwise the environment won't be re-read before the command is executed ...
$env.use_ansi_coloring = false
$"(ansi red)This shouldn't be Red, but it is(ansi reset)"Expected behavior
I expect the ansi command to disregard color and attribute codes when use_ansi_coloring is false.  ANSI codes related to cursor positioning, clearing the screen, and others should still be output.
Configuration
| key | value | 
|---|---|
| version | 0.98.1 | 
| major | 0 | 
| minor | 98 | 
| patch | 1 | 
| branch | virtual-mods | 
| commit_hash | 1dc58b8 | 
| build_os | linux-x86_64 | 
| build_target | x86_64-unknown-linux-gnu | 
| rust_version | rustc 1.79.0 (129f3b996 2024-06-10) | 
| rust_channel | 1.79.0-x86_64-unknown-linux-gnu | 
| cargo_version | cargo 1.79.0 (ffa9cf99a 2024-06-03) | 
| build_time | 2024-10-09 13:39:29 -04:00 | 
| build_rust_channel | release | 
| allocator | mimalloc | 
| features | default, sqlite, trash | 
| installed_plugins |