(&self)
| 85 | |
| 86 | impl TeamDelete { |
| 87 | async fn execute(&self) -> CliResult<()> { |
| 88 | // Prompt for confirmation unless --force is set. |
| 89 | if !self.force { |
| 90 | print_warning(&format!( |
| 91 | "This will permanently delete team '{}' and all its memberships and grants.", |
| 92 | self.slug |
| 93 | )); |
| 94 | |
| 95 | let confirmed = dialoguer::Confirm::new() |
| 96 | .with_prompt("Are you sure?") |
| 97 | .default(false) |
| 98 | .interact() |
| 99 | .map_err(|e| { |
| 100 | CliError::Internal(anyhow::anyhow!("Failed to read confirmation: {e}")) |
| 101 | })?; |
| 102 | |
| 103 | if !confirmed { |
| 104 | return Err(CliError::Cancelled); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | let client = build_client(self.org.as_deref(), None).await?; |
| 109 | let org_slug = client.org_slug().to_string(); |
| 110 | |
| 111 | atomic_teams::team::delete_team(&client, &org_slug, &self.slug) |
| 112 | .await |
| 113 | .map_err(|e| CliError::RemoteError { |
| 114 | message: e.to_string(), |
| 115 | url: None, |
| 116 | })?; |
| 117 | |
| 118 | print_success(&format!("Deleted team: {}", self.slug)); |
| 119 | |
| 120 | Ok(()) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | #[cfg(test)] |
no test coverage detected