Fix case of color options to ls

This commit is contained in:
Thayne McCombs 2022-07-25 22:23:47 -06:00
parent b7f5f4ac7d
commit 066ce41299
2 changed files with 12 additions and 1 deletions

View file

@ -655,6 +655,17 @@ pub enum ColorWhen {
Never,
}
impl ColorWhen {
pub fn as_str(&self) -> &'static str {
use ColorWhen::*;
match *self {
Auto => "auto",
Always => "always",
Never => "never",
}
}
}
// 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 {

View file

@ -293,7 +293,7 @@ fn extract_command(opts: &mut Opts, colored_output: bool) -> Result<Option<Comma
if !opts.list_details {
return None;
}
let color_arg = format!("--color={:?}", opts.color);
let color_arg = format!("--color={}", opts.color.as_str());
let res = determine_ls_command(&color_arg, colored_output)
.map(|cmd| CommandSet::new_batch([cmd]).unwrap());