mirror of https://github.com/sharkdp/fd.git
Use NO_COLOR env variable check also for help screen
This commit is contained in:
parent
6830b3dee9
commit
2cd3de8b94
|
@ -1,10 +1,17 @@
|
||||||
use clap::{crate_version, App, AppSettings, Arg};
|
use clap::{crate_version, App, AppSettings, Arg};
|
||||||
|
|
||||||
pub fn build_app() -> App<'static, 'static> {
|
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")
|
let mut app = App::new("fd")
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.usage("fd [FLAGS/OPTIONS] [<pattern>] [<path>...]")
|
.usage("fd [FLAGS/OPTIONS] [<pattern>] [<path>...]")
|
||||||
.setting(AppSettings::ColoredHelp)
|
.setting(clap_color_setting)
|
||||||
.setting(AppSettings::DeriveDisplayOrder)
|
.setting(AppSettings::DeriveDisplayOrder)
|
||||||
.after_help(
|
.after_help(
|
||||||
"Note: `fd -h` prints a short and concise overview while `fd --help` gives all \
|
"Note: `fd -h` prints a short and concise overview while `fd --help` gives all \
|
||||||
|
|
Loading…
Reference in New Issue