Load the delegating identity: `--identity`, else the store default.
(store: &IdentityStore, name: Option<&str>)
| 372 | |
| 373 | /// Load the delegating identity: `--identity`, else the store default. |
| 374 | fn load_delegator(store: &IdentityStore, name: Option<&str>) -> CliResult<Identity> { |
| 375 | match name { |
| 376 | Some(name) => store |
| 377 | .load_by_name(name) |
| 378 | .map_err(|_| CliError::IdentityNotFound(name.to_string())), |
| 379 | None => store |
| 380 | .get_default() |
| 381 | .map_err(|e| { |
| 382 | CliError::Internal(anyhow::anyhow!("Failed to load default identity: {e}")) |
| 383 | })? |
| 384 | .ok_or_else(|| { |
| 385 | CliError::Internal(anyhow::anyhow!( |
| 386 | "No default identity set. Create one first:\n \ |
| 387 | atomic identity new <name> --email <email> --set-default" |
| 388 | )) |
| 389 | }), |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | /// `alice@example.com` + `claude` → `alice+claude@example.com`. |
| 394 | /// |
no test coverage detected