(&self)
| 73 | |
| 74 | impl 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| { |
no test coverage detected