Merge pull request #941 from kit494way/config-delimiter

Allow delimiter variable option to be set from config.yaml
This commit is contained in:
Denis Isidoro 2025-02-13 02:36:33 -03:00 committed by GitHub
commit 72b0d14589
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 0 deletions

View file

@ -17,6 +17,7 @@ finder:
command: fzf # equivalent to the --finder option
# overrides: --tac # equivalent to the --fzf-overrides option
# overrides_var: --tac # equivalent to the --fzf-overrides-var option
# delimiter_var: \s\s+ # equivalent to the --delimiter option that is used with --column option when you extract a column from the selected result for a variable
# cheats:
# paths:

View file

@ -99,6 +99,10 @@ impl Config {
.or_else(|| self.yaml.finder.overrides_var.clone())
}
pub fn delimiter_var(&self) -> Option<String> {
self.yaml.finder.delimiter_var.clone()
}
pub fn tealdeer(&self) -> bool {
self.yaml.client.tealdeer
}

View file

@ -47,6 +47,7 @@ pub struct Finder {
pub command: FinderChoice,
pub overrides: Option<String>,
pub overrides_var: Option<String>,
pub delimiter_var: Option<String>,
}
fn finder_deserialize<'de, D>(deserializer: D) -> Result<FinderChoice, D::Error>
@ -158,6 +159,7 @@ impl Default for Finder {
command: FinderChoice::Fzf,
overrides: None,
overrides_var: None,
delimiter_var: None,
}
}
}

View file

@ -66,6 +66,7 @@ impl Opts {
overrides: CONFIG.fzf_overrides_var(),
suggestion_type: SuggestionType::SingleRecommendation,
prevent_select1: false,
delimiter: CONFIG.delimiter_var(),
..Default::default()
}
}