diff --git a/src/app.rs b/src/app.rs index b5dee4a..685f184 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,10 +1,17 @@ use clap::{crate_version, App, AppSettings, Arg}; pub fn build_app() -> App<'static, 'static> { + let clap_color_setting = + if std::env::var_os("NO_COLOR").is_none() { + AppSettings::ColoredHelp + } else { + AppSettings::ColorNever + }; + let mut app = App::new("fd") .version(crate_version!()) .usage("fd [FLAGS/OPTIONS] [] [...]") - .setting(AppSettings::ColoredHelp) + .setting(clap_color_setting) .setting(AppSettings::DeriveDisplayOrder) .after_help( "Note: `fd -h` prints a short and concise overview while `fd --help` gives all \