yaml: add support for cheats.paths

This commit is contained in:
Denis Isidoro 2021-08-07 10:42:46 -03:00 committed by GitHub
parent cd57b23b78
commit 954bc8871b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -19,7 +19,10 @@ finder:
# overrides_var: --tac # equivalent to the --fzf-overrides-var option
# cheats:
# path: /path/to/some/dir # equivalent to the --path option
# paths:
# - /path/to/some/dir
# - /path/to/another/dir
# path: /path/to/some/dir # (DEPRECATED) equivalent to the --path option
# search:
# tags: git,!checkout # equivalent to the --tag-rules option

View file

@ -55,6 +55,14 @@ impl Config {
.path
.clone()
.or_else(|| self.env.path.clone())
.or_else(|| {
let p = self.yaml.cheats.paths.clone();
if p.is_empty() {
None
} else {
Some(p.join(":"))
}
})
.or_else(|| self.yaml.cheats.path.clone())
}

View file

@ -67,6 +67,7 @@ where
#[serde(default)]
pub struct Cheats {
pub path: Option<String>,
pub paths: Vec<String>,
}
#[derive(Deserialize)]
@ -159,7 +160,10 @@ impl Default for Finder {
impl Default for Cheats {
fn default() -> Self {
Self { path: None }
Self {
path: None,
paths: Vec::new(),
}
}
}