(&self)
| 79 | |
| 80 | impl OrgCreate { |
| 81 | async fn execute(&self) -> CliResult<()> { |
| 82 | // Build an apex client (no org subdomain). `POST /orgs` is an apex |
| 83 | // endpoint that spans orgs, so it must be hit on the bare server host — |
| 84 | // and crucially this works even when no default org is configured yet. |
| 85 | let client = build_apex_client(None).await?; |
| 86 | |
| 87 | let info = atomic_teams::org::create_org(&client, &self.name, self.email.as_deref()) |
| 88 | .await |
| 89 | .map_err(|e| CliError::RemoteError { |
| 90 | message: e.to_string(), |
| 91 | url: None, |
| 92 | })?; |
| 93 | |
| 94 | print_success(&format!("Created organization: {}", info.slug)); |
| 95 | println!(); |
| 96 | |
| 97 | let table = KeyValueTable::new() |
| 98 | .add("Name", &info.name) |
| 99 | .add("Slug", &info.slug) |
| 100 | .add("Kind", &info.kind) |
| 101 | .add("Plan", &info.plan); |
| 102 | let table = if let Some(email) = &info.email { |
| 103 | table.add("Email", email) |
| 104 | } else { |
| 105 | table |
| 106 | }; |
| 107 | let table = table.add("ID", info.id.to_string()); |
| 108 | |
| 109 | println!("{table}"); |
| 110 | |
| 111 | print_next_steps(&[ |
| 112 | ( |
| 113 | &format!("atomic org set {}", info.slug), |
| 114 | "Set as your default org", |
| 115 | ), |
| 116 | ("atomic org member add <id>", "Add members to the org"), |
| 117 | ("atomic team create <name>", "Create a team"), |
| 118 | ]); |
| 119 | |
| 120 | Ok(()) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | #[cfg(test)] |
no test coverage detected