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