mirror of
https://github.com/denisidoro/navi
synced 2024-11-13 23:37:10 +00:00
Potentialy fix error string creation to only be done when needed.
This commit is contained in:
parent
f214a561b8
commit
8c4100abea
1 changed files with 7 additions and 4 deletions
|
@ -13,13 +13,16 @@ pub fn handle_config(config: Config) -> Result<(), Error> {
|
|||
Preview { line } => flows::preview::main(&line[..]),
|
||||
|
||||
Query { query } => {
|
||||
let error_string = format!("Failed to filter cheatsheets for {}", &query);
|
||||
flows::query::main(query.clone(), config).context(error_string)
|
||||
let query_clone = query.clone();
|
||||
flows::query::main(query.clone(), config)
|
||||
.with_context(|| format!("Failed to filter cheatsheets for {}", query_clone))
|
||||
}
|
||||
|
||||
Best { query, args } => {
|
||||
let error_string = format!("Failed to execute snippet similar to {}", &query);
|
||||
flows::best::main(query.clone(), args.to_vec(), config).context(error_string)
|
||||
let query_clone = query.clone();
|
||||
flows::best::main(query.clone(), args.to_vec(), config).with_context(|| {
|
||||
format!("Failed to execute snippet similar to {}", query_clone)
|
||||
})
|
||||
}
|
||||
|
||||
Search { query } => flows::search::main(query.clone(), config)
|
||||
|
|
Loading…
Reference in a new issue