mirror of
https://github.com/lsd-rs/lsd.git
synced 2026-04-20 10:26:49 +02:00
theme: 🔨 not deserialize no color and no lscolors from config
Signed-off-by: zwPapEr <zw.paper@gmail.com>
This commit is contained in:
@@ -462,7 +462,12 @@ mod tests {
|
||||
.to_string();
|
||||
|
||||
// check if the color is present.
|
||||
assert_eq!(true, output.starts_with("\u{1b}[38;5;"), "start with color");
|
||||
assert_eq!(
|
||||
true,
|
||||
output.starts_with("\u{1b}[38;5;"),
|
||||
"{:?} should start with color",
|
||||
output,
|
||||
);
|
||||
assert_eq!(true, output.ends_with("[39m"), "reset foreground color");
|
||||
|
||||
assert_eq!(get_visible_width(&output), *l, "visible match");
|
||||
|
||||
@@ -38,6 +38,7 @@ impl Color {
|
||||
pub enum ThemeOption {
|
||||
NoColor,
|
||||
Default,
|
||||
#[allow(dead_code)]
|
||||
NoLscolors,
|
||||
Custom(String),
|
||||
}
|
||||
@@ -76,7 +77,7 @@ impl<'de> de::Deserialize<'de> for ThemeOption {
|
||||
type Value = ThemeOption;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("`no-color`, `default`, `no-lscolors` or <theme-file-path>")
|
||||
formatter.write_str("`default` or <theme-file-path>")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<ThemeOption, E>
|
||||
@@ -84,9 +85,7 @@ impl<'de> de::Deserialize<'de> for ThemeOption {
|
||||
E: de::Error,
|
||||
{
|
||||
match value {
|
||||
"no-color" => Ok(ThemeOption::NoColor),
|
||||
"default" => Ok(ThemeOption::Default),
|
||||
"no-lscolors" => Ok(ThemeOption::NoLscolors),
|
||||
str => Ok(ThemeOption::Custom(str.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user