diff --git a/README.md b/README.md index aa13ece91..a465245a1 100644 --- a/README.md +++ b/README.md @@ -215,9 +215,9 @@ color: when: auto # How to colorize the output. # When "classic" is set, this is set to "no-color". - # Possible values: default, no-color, no-lscolors, - # when specifying , lsd will look up theme file in - # XDG Base Directory if relative + # Possible values: default, + # when specifying , lsd will look up theme file + # XDG Base Directory if relative, e.g. ~/.config/lsd/themes/, # The file path if absolute theme: default @@ -322,7 +322,7 @@ The valid theme configurations are: when configured with the `theme-file-name` which is a `yaml` file, `lsd` will look up the theme file in the following way: -- relative name: check the XDG Base Directory +- relative name: check the themes under XDG Base Directory, e.g. ~/.config/lsd/themes/ - absolute name: use the file path and name to find theme file Check [Theme file content](#theme-file-content) for details. diff --git a/src/color.rs b/src/color.rs index 4cbc74c10..99ec6dba3 100644 --- a/src/color.rs +++ b/src/color.rs @@ -136,12 +136,11 @@ impl Colors { ThemeOption::NoColor => None, ThemeOption::Default => Some(Theme::default()), ThemeOption::NoLscolors => Some(Theme::default()), - ThemeOption::Custom(ref file) => { - Some(Theme::from_path(file).unwrap_or_else(Theme::default)) - } + ThemeOption::Custom(ref file) => Some(Theme::from_path(file).unwrap_or_default()), }; let lscolors = match t { ThemeOption::Default => Some(LsColors::from_env().unwrap_or_default()), + ThemeOption::Custom(_) => Some(LsColors::from_env().unwrap_or_default()), _ => None, }; diff --git a/src/color/theme.rs b/src/color/theme.rs index 854ade7b3..1babedaec 100644 --- a/src/color/theme.rs +++ b/src/color/theme.rs @@ -132,7 +132,7 @@ impl Theme { let path = if Path::new(&real).is_absolute() { real } else { - config_file::Config::config_file_path().unwrap().join(real) + config_file::Config::config_file_path()?.join("themes").join(real) }; match fs::read(&path) { Ok(f) => match Self::with_yaml(&String::from_utf8_lossy(&f)) { diff --git a/src/flags/icons.rs b/src/flags/icons.rs index 48e305ad0..77217d089 100644 --- a/src/flags/icons.rs +++ b/src/flags/icons.rs @@ -100,16 +100,7 @@ pub enum IconTheme { Fancy, } -impl IconTheme { - // /// Get a value from a string. - // fn from_str(value: &str) -> Option { - // match value { - // "fancy" => Some(Self::Fancy), - // "unicode" => Some(Self::Unicode), - // _ => panic!("Bad icons.theme config, {}", &value), - // } - // } -} +impl IconTheme {} impl Configurable for IconTheme { /// Get a potential `IconTheme` variant from [ArgMatches]. diff --git a/src/flags/layout.rs b/src/flags/layout.rs index 74c176143..0b917bbf6 100644 --- a/src/flags/layout.rs +++ b/src/flags/layout.rs @@ -14,7 +14,6 @@ use serde::Deserialize; pub enum Layout { Grid, Tree, - #[serde(rename = "oneline")] OneLine, } diff --git a/src/meta/mod.rs b/src/meta/mod.rs index 476b08d47..0a55d7052 100644 --- a/src/meta/mod.rs +++ b/src/meta/mod.rs @@ -249,12 +249,12 @@ impl Meta { } } +#[cfg(unix)] #[cfg(test)] mod tests { use super::Meta; #[test] - #[cfg(unix)] fn test_from_path_path() { let dir = assert_fs::TempDir::new().unwrap(); let meta = Meta::from_path(dir.path(), false).unwrap();