diff --git a/CHANGELOG.md b/CHANGELOG.md index fa857d1a1..e852038c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ## Bugfixes +- Respect NO_COLOR environment variable with `--list-details` option. (#1455) + ## Changes diff --git a/src/cli.rs b/src/cli.rs index 3bd8d8403..0007a3160 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -758,17 +758,6 @@ pub enum ColorWhen { 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, // so we have to use hand-rolled parsing for exec and exec-batch pub struct Exec { diff --git a/src/main.rs b/src/main.rs index 5440601ec..bef4120ec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -325,18 +325,22 @@ fn extract_command(opts: &mut Opts, colored_output: bool) -> Result Result> { +fn determine_ls_command(colored_output: bool) -> Result> { #[allow(unused)] 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 // platforms (like BusyBox). vec![