(&self)
| 79 | |
| 80 | impl OrgCreate { |
| 81 | async fn execute(&self) -> CliResult<()> { |
| 82 | // Build client using current default org (doesn't matter which org |
| 83 | // we're scoped to — the server creates a new org regardless). |
| 84 | let client = build_client(None, None).await?; |
| 85 | |
| 86 | let info = atomic_teams::org::create_org(&client, &self.name, self.email.as_deref()) |
| 87 | .await |
| 88 | .map_err(|e| CliError::RemoteError { |
| 89 | message: e.to_string(), |
| 90 | url: None, |
| 91 | })?; |
| 92 | |
| 93 | print_success(&format!("Created organization: {}", info.slug)); |
| 94 | println!(); |
| 95 | |
| 96 | let table = KeyValueTable::new() |
| 97 | .add("Name", &info.name) |
| 98 | .add("Slug", &info.slug) |
| 99 | .add("Kind", &info.kind) |
| 100 | .add("Plan", &info.plan); |
| 101 | let table = if let Some(email) = &info.email { |
| 102 | table.add("Email", email) |
| 103 | } else { |
| 104 | table |
| 105 | }; |
| 106 | let table = table.add("ID", info.id.to_string()); |
| 107 | |
| 108 | println!("{table}"); |
| 109 | |
| 110 | print_next_steps(&[ |
| 111 | ( |
| 112 | &format!("atomic org set {}", info.slug), |
| 113 | "Set as your default org", |
| 114 | ), |
| 115 | ("atomic org member add <id>", "Add members to the org"), |
| 116 | ("atomic team create <name>", "Create a team"), |
| 117 | ]); |
| 118 | |
| 119 | Ok(()) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | #[cfg(test)] |
no test coverage detected