(&self)
| 91 | |
| 92 | impl OrgUpdate { |
| 93 | async fn execute(&self) -> CliResult<()> { |
| 94 | // At least one field must be provided to update. |
| 95 | if self.name.is_none() && self.email.is_none() { |
| 96 | return Err(CliError::InvalidArgument { |
| 97 | message: "At least one of --name or --email must be provided".to_string(), |
| 98 | }); |
| 99 | } |
| 100 | |
| 101 | let client = build_client(self.org.as_deref(), None).await?; |
| 102 | |
| 103 | // Determine which slug to update: explicit arg > client's org slug. |
| 104 | let slug = self.slug.as_deref().unwrap_or_else(|| client.org_slug()); |
| 105 | |
| 106 | let info = atomic_teams::org::update_org( |
| 107 | &client, |
| 108 | slug, |
| 109 | self.name.as_deref(), |
| 110 | self.email.as_deref(), |
| 111 | ) |
| 112 | .await |
| 113 | .map_err(|e| CliError::RemoteError { |
| 114 | message: e.to_string(), |
| 115 | url: None, |
| 116 | })?; |
| 117 | |
| 118 | print_success(&format!("Updated organization: {}", info.slug)); |
| 119 | println!(); |
| 120 | |
| 121 | let table = KeyValueTable::new() |
| 122 | .add("Name", &info.name) |
| 123 | .add("Slug", &info.slug) |
| 124 | .add("Kind", &info.kind) |
| 125 | .add("Plan", &info.plan); |
| 126 | let table = if let Some(email) = &info.email { |
| 127 | table.add("Email", email) |
| 128 | } else { |
| 129 | table |
| 130 | }; |
| 131 | let table = table.add("ID", info.id.to_string()); |
| 132 | |
| 133 | println!("{table}"); |
| 134 | |
| 135 | Ok(()) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | #[cfg(test)] |
no test coverage detected