enable ls_colors for the ls command (#340)

* enable ls_colors for the `ls` command

* added wrapping with ansi-cut so the ansi sequences don't bleed over

* clippy
This commit is contained in:
Darren Schroeder
2021-11-15 14:09:17 -06:00
committed by GitHub
parent 42367ddf6d
commit ab22619f4a
6 changed files with 210 additions and 47 deletions

View File

@ -6,6 +6,7 @@ use crate::{ShellError, Value};
pub struct Config {
pub filesize_metric: bool,
pub table_mode: String,
pub use_ls_colors: bool,
}
impl Default for Config {
@ -13,6 +14,7 @@ impl Default for Config {
Config {
filesize_metric: false,
table_mode: "rounded".into(),
use_ls_colors: true,
}
}
}
@ -31,6 +33,9 @@ impl Value {
"table_mode" => {
config.table_mode = value.as_string()?;
}
"use_ls_colors" => {
config.use_ls_colors = value.as_bool()?;
}
_ => {}
}
}