Use NO_COLOR env variable check also for help screen

This commit is contained in:
xanonid 2020-10-16 16:11:21 +02:00 committed by David Peter
parent 6830b3dee9
commit 2cd3de8b94

View file

@ -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] [<pattern>] [<path>...]")
.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 \