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

Method output_default

atomic-cli/src/commands/identity/whoami.rs:117–154  ·  view source on GitHub ↗

Output identity in human-readable format.

(
        &self,
        identity: &atomic_identity::Identity,
        context: Option<&IdentityUsage>,
    )

Source from the content-addressed store, hash-verified

115impl WhoAmI {
116 /// Output identity in human-readable format.
117 fn output_default(
118 &self,
119 identity: &atomic_identity::Identity,
120 context: Option<&IdentityUsage>,
121 ) {
122 if let Some(usage) = context {
123 print_section(&format!(
124 "Current identity for {}: {}",
125 usage, identity.name
126 ));
127 } else {
128 print_section(&format!("Current identity: {}", identity.name));
129 }
130 println!();
131
132 if let Some(email) = &identity.email {
133 println!(" Email: {}", email);
134 }
135
136 println!(
137 " Type: {}",
138 super::format_identity_type(&identity.identity_type)
139 );
140 println!(" Usage: {}", super::format_usage(&identity.usage));
141 println!(" Public Key: {}...", &identity.public_key_base32()[..24]);
142
143 if let Some(description) = &identity.metadata.description {
144 println!(" Description: {}", description);
145 }
146
147 // Show delegation info if relevant
148 if identity.identity_type.is_delegated() {
149 if let Some(delegator) = &identity.delegated_by {
150 println!();
151 print_info(&format!("Acting on behalf of: {}", delegator.short()));
152 }
153 }
154 }
155
156 /// Output identity as JSON.
157 fn output_json(&self, identity: &atomic_identity::Identity, context: Option<&IdentityUsage>) {

Callers 1

runMethod · 0.45

Calls 3

print_sectionFunction · 0.85
print_infoFunction · 0.85
is_delegatedMethod · 0.80

Tested by

no test coverage detected