(&self)
| 63 | |
| 64 | impl Command for ProjectDelete { |
| 65 | fn run(&self) -> CliResult<()> { |
| 66 | let rt = tokio::runtime::Runtime::new().map_err(|e| { |
| 67 | CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e)) |
| 68 | })?; |
| 69 | |
| 70 | rt.block_on(async { |
| 71 | let (ws_slug, proj_slug) = parse_project_path(&self.slug)?; |
| 72 | |
| 73 | // Confirm deletion unless --force is specified. |
| 74 | if !self.force { |
| 75 | let prompt = format!( |
| 76 | "Delete project '{}' from workspace '{}'? This cannot be undone.", |
| 77 | proj_slug, ws_slug, |
| 78 | ); |
| 79 | |
| 80 | let confirmed = dialoguer::Confirm::new() |
| 81 | .with_prompt(&prompt) |
| 82 | .default(false) |
| 83 | .interact() |
| 84 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Prompt failed: {}", e)))?; |
| 85 | |
| 86 | if !confirmed { |
| 87 | return Err(CliError::Cancelled); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | let client = build_client(self.org.as_deref(), None).await?; |
| 92 | |
| 93 | client |
| 94 | .delete_project(ws_slug, proj_slug) |
| 95 | .await |
| 96 | .map_err(|e| { |
| 97 | if e.is_not_found() { |
| 98 | print_error(&format!( |
| 99 | "Project '{}' not found in workspace '{}'", |
| 100 | proj_slug, ws_slug, |
| 101 | )); |
| 102 | } |
| 103 | remote_err(e) |
| 104 | })?; |
| 105 | |
| 106 | print_success(&format!( |
| 107 | "Deleted project {} from workspace {}", |
| 108 | proj_slug, ws_slug, |
| 109 | )); |
| 110 | |
| 111 | Ok(()) |
| 112 | }) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | #[cfg(test)] |
nothing calls this directly
no test coverage detected