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

Method execute

atomic-cli/src/commands/org/list.rs:75–100  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

73
74impl OrgList {
75 async fn execute(&self) -> CliResult<()> {
76 // Apex client: no org subdomain required, so this works even when no
77 // default org is configured (the whole point of `org list`).
78 let client = build_apex_client(self.server.as_deref()).await?;
79
80 let orgs = atomic_teams::org::list_my_orgs(&client)
81 .await
82 .map_err(|e| CliError::RemoteError {
83 message: e.to_string(),
84 url: None,
85 })?;
86
87 let is_json = self
88 .format
89 .as_deref()
90 .map(|f| f.eq_ignore_ascii_case("json"))
91 .unwrap_or(false);
92
93 if is_json {
94 self.output_json(&orgs)?;
95 } else {
96 self.output_table(&orgs);
97 }
98
99 Ok(())
100 }
101
102 fn output_json(&self, orgs: &[atomic_teams::MyOrgInfo]) -> CliResult<()> {
103 let json = serde_json::to_string_pretty(orgs).map_err(|e| {

Callers 1

runMethod · 0.45

Calls 4

build_apex_clientFunction · 0.85
list_my_orgsFunction · 0.85
output_jsonMethod · 0.45
output_tableMethod · 0.45

Tested by

no test coverage detected