mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 06:02:36 +00:00
refactor: merge match
branches with the same output
This commit is contained in:
parent
853fcb6fbf
commit
73b14ab8c4
1 changed files with 5 additions and 9 deletions
14
src/color.rs
14
src/color.rs
|
@ -139,13 +139,13 @@ impl Colors {
|
||||||
pub fn new(t: ThemeOption) -> Self {
|
pub fn new(t: ThemeOption) -> Self {
|
||||||
let theme = match t {
|
let theme = match t {
|
||||||
ThemeOption::NoColor => None,
|
ThemeOption::NoColor => None,
|
||||||
ThemeOption::Default => Some(Theme::default()),
|
ThemeOption::Default | ThemeOption::NoLscolors => Some(Theme::default()),
|
||||||
ThemeOption::NoLscolors => Some(Theme::default()),
|
|
||||||
ThemeOption::Custom(ref file) => Some(Theme::from_path(file).unwrap_or_default()),
|
ThemeOption::Custom(ref file) => Some(Theme::from_path(file).unwrap_or_default()),
|
||||||
};
|
};
|
||||||
let lscolors = match t {
|
let lscolors = match t {
|
||||||
ThemeOption::Default => Some(LsColors::from_env().unwrap_or_default()),
|
ThemeOption::Default | ThemeOption::Custom(_) => {
|
||||||
ThemeOption::Custom(_) => Some(LsColors::from_env().unwrap_or_default()),
|
Some(LsColors::from_env().unwrap_or_default())
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -222,11 +222,7 @@ impl Colors {
|
||||||
Elem::CharDevice => Some("cd"),
|
Elem::CharDevice => Some("cd"),
|
||||||
Elem::BrokenSymLink => Some("or"),
|
Elem::BrokenSymLink => Some("or"),
|
||||||
Elem::MissingSymLinkTarget => Some("mi"),
|
Elem::MissingSymLinkTarget => Some("mi"),
|
||||||
Elem::INode { valid } => match valid {
|
Elem::INode { valid } | Elem::Links { valid } => match valid {
|
||||||
true => Some("so"),
|
|
||||||
false => Some("no"),
|
|
||||||
},
|
|
||||||
Elem::Links { valid } => match valid {
|
|
||||||
true => Some("so"),
|
true => Some("so"),
|
||||||
false => Some("no"),
|
false => Some("no"),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue