-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--color never not supported for error output #353
Comments
@andreastt that's from I think there's a hacky way to workaround this...but it's hacky. You'd essentially be parsing the CLI twice in the case of a let mut app = build_cli();
let args: Args = match app.get_matches_safe() {
Err(e) => {
if (env::args().find(|arg| arg == "--color").is_some() && env::arg().find(|arg| arg == "never")) || env::args().find(|arg| arg == "--color=never") {
app.setting(AppSettings::ColorNever).get_matches();
}
e.exit();
},
Ok(m) => m.into(),
}; There's probably a far better way to do all that, but I'm going a lack of sleep and 8 plane rides 😜 |
|
@BurntSushi yep, once I get some time to sit down and actually implement clap-rs/clap#836 that's my exact plan 😉 |
Filed clap-rs/clap#847 with clap. |
If someone wants to fix this using @kbknapp's hack, then I'd be open to it. It might be hard to write a regression test for it though. |
Sure, I'll take a stab at it. |
There's a PR for |
@nateozem Let's try to get away with |
It looks like the clap PR was merged so I'm marking this as fixed. (You still can't use |
My shell does not support colours and consequently I set the environmental variable
TERM=dumb
to instruct programs never to colourise output.However, even when I pass
--color never
to rg, the error output includes colour escape codes as can be seen below:The text was updated successfully, but these errors were encountered: