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

Method execute

atomic-cli/src/commands/team/show.rs:88–132  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

86
87impl TeamShow {
88 async fn execute(&self) -> CliResult<()> {
89 let client = build_client(self.org.as_deref(), None).await?;
90 let org_slug = client.org_slug().to_string();
91
92 let info = atomic_teams::team::get_team(&client, &org_slug, &self.slug)
93 .await
94 .map_err(|e| CliError::RemoteError {
95 message: e.to_string(),
96 url: None,
97 })?;
98
99 let is_json = self
100 .format
101 .as_deref()
102 .map(|f| f.eq_ignore_ascii_case("json"))
103 .unwrap_or(false);
104
105 if is_json {
106 let json = serde_json::to_string_pretty(&info).map_err(|e| {
107 CliError::Internal(anyhow::anyhow!("Failed to serialize team info: {e}"))
108 })?;
109 println!("{json}");
110 } else {
111 let table = KeyValueTable::new()
112 .add("Name", &info.name)
113 .add("Slug", &info.slug)
114 .add("Visibility", info.visibility.to_string());
115
116 let table = if let Some(desc) = &info.description {
117 table.add("Description", desc)
118 } else {
119 table
120 };
121
122 let table = table
123 .add("Organization", &org_slug)
124 .add("ID", info.id.to_string())
125 .add("Created", info.created_at.to_rfc3339())
126 .add("Updated", info.updated_at.to_rfc3339());
127
128 println!("{table}");
129 }
130
131 Ok(())
132 }
133}
134
135#[cfg(test)]

Callers 1

runMethod · 0.45

Calls 4

build_clientFunction · 0.85
get_teamFunction · 0.85
org_slugMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected