mirror of
https://github.com/denisidoro/navi
synced 2024-11-26 13:30:22 +00:00
Remove need for lifetime on FzfOpts (#293)
This commit is contained in:
parent
73cd346c1b
commit
64045e32ca
4 changed files with 9 additions and 9 deletions
|
@ -29,7 +29,7 @@ fn gen_core_fzf_opts(variant: Variant, config: &Config) -> FzfOpts {
|
|||
Some(format!("{} preview {{}}", filesystem::exe_string()))
|
||||
},
|
||||
autoselect: !config.no_autoselect,
|
||||
overrides: config.fzf_overrides.as_ref(),
|
||||
overrides: config.fzf_overrides.clone(),
|
||||
suggestion_type: SuggestionType::SnippetSelection,
|
||||
..Default::default()
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ fn prompt_with_suggestions(
|
|||
|
||||
let mut opts = FzfOpts {
|
||||
autoselect: !config.no_autoselect,
|
||||
overrides: config.fzf_overrides_var.as_ref(),
|
||||
overrides: config.fzf_overrides_var.clone(),
|
||||
prompt: Some(display::variable_prompt(varname)),
|
||||
..Default::default()
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ fn prompt_with_suggestions(
|
|||
opts.suggestion_type = o.suggestion_type;
|
||||
opts.header_lines = o.header_lines;
|
||||
opts.column = o.column;
|
||||
opts.delimiter = o.delimiter.as_deref();
|
||||
opts.delimiter = o.delimiter.clone();
|
||||
};
|
||||
|
||||
let (output, _) = fzf::call(opts, |stdin| {
|
||||
|
|
|
@ -73,7 +73,7 @@ pub fn add(uri: String) -> Result<(), Box<dyn Error>> {
|
|||
header: Some(
|
||||
"Select the cheatsheets you want to import with <TAB> then hit <Enter>".to_string(),
|
||||
),
|
||||
overrides: Some(&overrides),
|
||||
overrides: Some(overrides),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ where
|
|||
get_column(
|
||||
parse_output_single(text, opts.suggestion_type),
|
||||
opts.column,
|
||||
opts.delimiter,
|
||||
opts.delimiter.as_deref(),
|
||||
),
|
||||
result,
|
||||
)
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
use crate::structures::cheat::SuggestionType;
|
||||
|
||||
pub struct Opts<'a> {
|
||||
pub struct Opts {
|
||||
pub query: Option<String>,
|
||||
pub filter: Option<String>,
|
||||
pub prompt: Option<String>,
|
||||
pub preview: Option<String>,
|
||||
pub autoselect: bool,
|
||||
pub overrides: Option<&'a String>, // TODO: remove &'a
|
||||
pub overrides: Option<String>,
|
||||
pub header_lines: u8,
|
||||
pub header: Option<String>,
|
||||
pub suggestion_type: SuggestionType,
|
||||
pub delimiter: Option<&'a str>,
|
||||
pub delimiter: Option<String>,
|
||||
pub column: Option<u8>,
|
||||
}
|
||||
|
||||
impl Default for Opts<'_> {
|
||||
impl Default for Opts {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
query: None,
|
||||
|
|
Loading…
Reference in a new issue