Add tryfrom for Lookups

This commit is contained in:
2026-05-01 14:52:09 +02:00
parent f8f1165db7
commit e9d6aa2e31
2 changed files with 14 additions and 15 deletions
+2 -15
View File
@@ -85,21 +85,8 @@ fn main() -> Result<(), Box<dyn Error>> {
} => {
inputs = inp;
let output_plan = if let Some(plan) = plan {
Ok(ynab::Lookup::Name(plan))
} else if let Some(plan_id) = plan_id {
Ok(ynab::Lookup::Id(plan_id))
} else {
Err("no plan name or id".to_string())
}?;
let output_account = if let Some(account) = account {
Ok(ynab::Lookup::Name(account))
} else if let Some(account_id) = account_id {
Ok(ynab::Lookup::Id(account_id))
} else {
Err("no account name or id".to_string())
}?;
let output_plan = ynab::Lookup::try_from((plan, plan_id))?;
let output_account = ynab::Lookup::try_from((account, account_id))?;
Output::Ynab {
token,