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

Method output_table

atomic-cli/src/commands/org/list.rs:110–175  ·  view source on GitHub ↗
(&self, orgs: &[atomic_teams::MyOrgInfo])

Source from the content-addressed store, hash-verified

108 }
109
110 fn output_table(&self, orgs: &[atomic_teams::MyOrgInfo]) {
111 if orgs.is_empty() {
112 print_info("You do not belong to any organizations.");
113 println!();
114 print_hint("Create one with: atomic org create <name>");
115 return;
116 }
117
118 // When there is exactly one org, a key/value card reads better than a
119 // wide table and matches the legacy single-org output.
120 if orgs.len() == 1 {
121 print_section("Your organization:");
122 println!();
123 let o = &orgs[0];
124 let table = KeyValueTable::new()
125 .add("Name", &o.name)
126 .add("Slug", &o.slug)
127 .add("Kind", &o.kind)
128 .add("Plan", &o.plan)
129 .add("Role", &o.role);
130 let table = if let Some(email) = &o.email {
131 table.add("Email", email)
132 } else {
133 table
134 };
135 let table = table
136 .add("ID", o.id.to_string())
137 .add("Joined", o.joined_at.to_rfc3339());
138 println!("{table}");
139 println!();
140 print_hint("Use 'atomic org set <slug>' to set this as your default organization.");
141 return;
142 }
143
144 let mut table = Table::new();
145 table.set_columns(vec![
146 Column::new("NAME").min_width(12),
147 Column::new("SLUG").min_width(10),
148 Column::new("KIND").min_width(8),
149 Column::new("ROLE").min_width(6),
150 Column::new("PLAN").min_width(6),
151 Column::new("EMAIL").min_width(16),
152 ]);
153
154 for o in orgs {
155 table.add_row(vec![
156 o.name.clone(),
157 o.slug.clone(),
158 o.kind.clone(),
159 o.role.clone(),
160 o.plan.clone(),
161 o.email.clone().unwrap_or_default(),
162 ]);
163 }
164
165 println!("{table}");
166 println!();
167 let word = if orgs.len() == 1 {

Callers 1

executeMethod · 0.45

Calls 8

print_infoFunction · 0.85
print_hintFunction · 0.85
print_sectionFunction · 0.85
set_columnsMethod · 0.80
add_rowMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected