Skip to content
Myr

fix: Respect NO_COLOR with --list-details option

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Thayne McCombs · committed by David Peter · parent 266311c · Browse files · 3 files+9 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Fixes: #1455

Diff stats

3 files+9 added−14 removed

  • other:+9 added−14 removed

3 files+9 added−14 removed

modified:src/cli.rs-11 removed
756 unmodified lines
757 /// do not use colorized output758 Never,759}760761impl ColorWhen {762 pub fn as_str(&self) -> &'static str {763 use ColorWhen::*;764 match *self {765 Auto => "auto",766 Never => "never",767 Always => "always",768 }769 }770}771761// there isn't a derive api for getting grouped values yet,762// so we have to use hand-rolled parsing for exec and exec-batch763pub struct Exec {764 pub command: Option<CommandSet>,
110 unmodified lines
modified:src/main.rs+7 added-3 removed
323 unmodified lines
324 .or_else(|| {325 if !opts.list_details {326 return None;327 }328 let color_arg = format!("--color={}", opts.color.as_str());328330 let res = determine_ls_command(&color_arg, colored_output)329 let res = determine_ls_command(colored_output)330 .map(|cmd| CommandSet::new_batch([cmd]).unwrap());331 Some(res)332 })333 .transpose()334}335337fn determine_ls_command(color_arg: &str, colored_output: bool) -> Result<Vec<&str>> {336fn determine_ls_command(colored_output: bool) -> Result<Vec<&'static str>> {337 #[allow(unused)]338 let gnu_ls = |command_name| {339 let color_arg = if colored_output {340 "--color=always"341 } else {342 "--color=never"343 };344 // Note: we use short options here (instead of --long-options) to support more345 // platforms (like BusyBox).346 vec![347 command_name,
132 unmodified lines
modified:CHANGELOG.md+2 added
3 unmodified lines
456## Bugfixes78- Respect NO_COLOR environment variable with `--list-details` option. (#1455)91011## Changes121314## Other
734 unmodified lines