mirror of https://github.com/sharkdp/fd.git
parent
266311ca33
commit
9529f30129
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
|
- Respect NO_COLOR environment variable with `--list-details` option. (#1455)
|
||||||
|
|
||||||
|
|
||||||
## Changes
|
## Changes
|
||||||
|
|
||||||
|
|
11
src/cli.rs
11
src/cli.rs
|
@ -758,17 +758,6 @@ pub enum ColorWhen {
|
||||||
Never,
|
Never,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColorWhen {
|
|
||||||
pub fn as_str(&self) -> &'static str {
|
|
||||||
use ColorWhen::*;
|
|
||||||
match *self {
|
|
||||||
Auto => "auto",
|
|
||||||
Never => "never",
|
|
||||||
Always => "always",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// there isn't a derive api for getting grouped values yet,
|
// there isn't a derive api for getting grouped values yet,
|
||||||
// so we have to use hand-rolled parsing for exec and exec-batch
|
// so we have to use hand-rolled parsing for exec and exec-batch
|
||||||
pub struct Exec {
|
pub struct Exec {
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -325,18 +325,22 @@ fn extract_command(opts: &mut Opts, colored_output: bool) -> Result<Option<Comma
|
||||||
if !opts.list_details {
|
if !opts.list_details {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let color_arg = format!("--color={}", opts.color.as_str());
|
|
||||||
|
|
||||||
let res = determine_ls_command(&color_arg, colored_output)
|
let res = determine_ls_command(colored_output)
|
||||||
.map(|cmd| CommandSet::new_batch([cmd]).unwrap());
|
.map(|cmd| CommandSet::new_batch([cmd]).unwrap());
|
||||||
Some(res)
|
Some(res)
|
||||||
})
|
})
|
||||||
.transpose()
|
.transpose()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn determine_ls_command(color_arg: &str, colored_output: bool) -> Result<Vec<&str>> {
|
fn determine_ls_command(colored_output: bool) -> Result<Vec<&'static str>> {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
let gnu_ls = |command_name| {
|
let gnu_ls = |command_name| {
|
||||||
|
let color_arg = if colored_output {
|
||||||
|
"--color=always"
|
||||||
|
} else {
|
||||||
|
"--color=never"
|
||||||
|
};
|
||||||
// Note: we use short options here (instead of --long-options) to support more
|
// Note: we use short options here (instead of --long-options) to support more
|
||||||
// platforms (like BusyBox).
|
// platforms (like BusyBox).
|
||||||
vec![
|
vec![
|
||||||
|
|
Loading…
Reference in New Issue