mirror of
https://github.com/denisidoro/navi
synced 2024-11-10 05:54:18 +00:00
yaml: add support for cheats.paths
This commit is contained in:
parent
cd57b23b78
commit
954bc8871b
3 changed files with 17 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue