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

Method run

atomic-cli/src/commands/identity/list.rs:92–121  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

90
91impl Command for List {
92 fn run(&self) -> CliResult<()> {
93 // Open the identity store
94 let store = IdentityStore::open_default().map_err(|e| {
95 CliError::Internal(anyhow::anyhow!("Failed to open identity store: {}", e))
96 })?;
97
98 // Get the default identity ID for marking
99 let default_id = store.get_default().ok().flatten().map(|i| i.id);
100
101 // List identities with filter
102 let filter = self.build_filter();
103 let identities = store
104 .list_filtered(&filter)
105 .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to list identities: {}", e)))?;
106
107 if identities.is_empty() {
108 print_info("No identities found");
109 println!();
110 print_hint("Create a new identity with: atomic identity new <name> --email <email>");
111 return Ok(());
112 }
113
114 // Output based on format
115 match self.format.to_lowercase().as_str() {
116 "json" => self.output_json(&identities, default_id.as_ref()),
117 _ => self.output_table(&identities, default_id.as_ref()),
118 }
119
120 Ok(())
121 }
122}
123
124impl List {

Callers

nothing calls this directly

Calls 10

print_infoFunction · 0.85
print_hintFunction · 0.85
build_filterMethod · 0.80
list_filteredMethod · 0.80
as_refMethod · 0.80
output_tableMethod · 0.80
get_defaultMethod · 0.45
is_emptyMethod · 0.45
as_strMethod · 0.45
output_jsonMethod · 0.45

Tested by

no test coverage detected