Skip to content

Commit 954bc88

Browse files
authored
yaml: add support for cheats.paths
1 parent cd57b23 commit 954bc88

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

docs/config_file_example.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ finder:
1919
# overrides_var: --tac # equivalent to the --fzf-overrides-var option
2020

2121
# cheats:
22-
# path: /path/to/some/dir # equivalent to the --path option
22+
# paths:
23+
# - /path/to/some/dir
24+
# - /path/to/another/dir
25+
# path: /path/to/some/dir # (DEPRECATED) equivalent to the --path option
2326

2427
# search:
2528
# tags: git,!checkout # equivalent to the --tag-rules option

src/config/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ impl Config {
5555
.path
5656
.clone()
5757
.or_else(|| self.env.path.clone())
58+
.or_else(|| {
59+
let p = self.yaml.cheats.paths.clone();
60+
if p.is_empty() {
61+
None
62+
} else {
63+
Some(p.join(":"))
64+
}
65+
})
5866
.or_else(|| self.yaml.cheats.path.clone())
5967
}
6068

src/config/yaml.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ where
6767
#[serde(default)]
6868
pub struct Cheats {
6969
pub path: Option<String>,
70+
pub paths: Vec<String>,
7071
}
7172

7273
#[derive(Deserialize)]
@@ -159,7 +160,10 @@ impl Default for Finder {
159160

160161
impl Default for Cheats {
161162
fn default() -> Self {
162-
Self { path: None }
163+
Self {
164+
path: None,
165+
paths: Vec::new(),
166+
}
163167
}
164168
}
165169

0 commit comments

Comments
 (0)