mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-18 09:50:34 +01:00
Use NO_COLOR env variable check also for help screen
This commit is contained in:
parent
6830b3dee9
commit
2cd3de8b94
1 changed files with 8 additions and 1 deletions
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue