Output identity in human-readable format.
(
&self,
identity: &atomic_identity::Identity,
context: Option<&IdentityUsage>,
)
| 115 | impl 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>) { |
no test coverage detected