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

Method execute

atomic-cli/src/commands/org/show.rs:87–133  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

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

Callers 1

runMethod · 0.45

Calls 4

build_clientFunction · 0.85
get_orgFunction · 0.85
org_slugMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected