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

Function load_delegator

atomic-cli/src/commands/identity/agent/create.rs:381–398  ·  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

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

Callers 1

executeMethod · 0.85

Calls 2

load_by_nameMethod · 0.80
get_defaultMethod · 0.45

Tested by

no test coverage detected