(&self)
| 108 | |
| 109 | impl TeamUpdate { |
| 110 | async fn execute(&self) -> CliResult<()> { |
| 111 | // At least one field must be provided to update. |
| 112 | if self.name.is_none() && self.description.is_none() && self.visibility.is_none() { |
| 113 | return Err(CliError::InvalidArgument { |
| 114 | message: "At least one of --name, --description, or --visibility must be provided" |
| 115 | .to_string(), |
| 116 | }); |
| 117 | } |
| 118 | |
| 119 | // Parse visibility if provided. |
| 120 | let visibility = self |
| 121 | .visibility |
| 122 | .as_deref() |
| 123 | .map(|v| { |
| 124 | v.parse::<TeamVisibility>() |
| 125 | .map_err(|_| CliError::InvalidArgument { |
| 126 | message: format!( |
| 127 | "Invalid visibility '{}'. Valid values: visible, secret", |
| 128 | v |
| 129 | ), |
| 130 | }) |
| 131 | }) |
| 132 | .transpose()?; |
| 133 | |
| 134 | let client = build_client(self.org.as_deref(), None).await?; |
| 135 | let org_slug = client.org_slug().to_string(); |
| 136 | |
| 137 | let info = atomic_teams::team::update_team( |
| 138 | &client, |
| 139 | &org_slug, |
| 140 | &self.slug, |
| 141 | self.name.as_deref(), |
| 142 | self.description.as_deref(), |
| 143 | visibility, |
| 144 | ) |
| 145 | .await |
| 146 | .map_err(|e| CliError::RemoteError { |
| 147 | message: e.to_string(), |
| 148 | url: None, |
| 149 | })?; |
| 150 | |
| 151 | print_success(&format!("Updated team: {}", info.slug)); |
| 152 | println!(); |
| 153 | |
| 154 | let table = KeyValueTable::new() |
| 155 | .add("Name", &info.name) |
| 156 | .add("Slug", &info.slug) |
| 157 | .add("Visibility", info.visibility.to_string()); |
| 158 | let table = if let Some(desc) = &info.description { |
| 159 | table.add("Description", desc) |
| 160 | } else { |
| 161 | table |
| 162 | }; |
| 163 | let table = table |
| 164 | .add("Organization", &org_slug) |
| 165 | .add("ID", info.id.to_string()); |
| 166 | |
| 167 | println!("{table}"); |
no test coverage detected