MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / load_delegator

Function load_delegator

atomic-cli/src/commands/identity/agent/create.rs:374–391  ·  view source on GitHub ↗

Load the delegating identity: `--identity`, else the store default.

(store: &IdentityStore, name: Option<&str>)

Source from the content-addressed store, hash-verified

372
373/// Load the delegating identity: `--identity`, else the store default.
374fn 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///

Callers 1

executeMethod · 0.85

Calls 2

load_by_nameMethod · 0.80
get_defaultMethod · 0.45

Tested by

no test coverage detected