(client *api.Client, instanceID string)
| 346 | } |
| 347 | |
| 348 | func RunDeleteProgress(client *api.Client, instanceID string) (string, error) { |
| 349 | InitCommonStyles(os.Stdout) |
| 350 | |
| 351 | m := newDeleteProgressModel(client, instanceID, fmt.Sprintf("Deleting instance %s...", instanceID)) |
| 352 | p := tea.NewProgram(m) |
| 353 | finalModel, err := p.Run() |
| 354 | if err != nil { |
| 355 | return "", fmt.Errorf("error running deletion: %w", err) |
| 356 | } |
| 357 | |
| 358 | result, ok := finalModel.(deleteProgressModel) |
| 359 | if !ok { |
| 360 | return "", fmt.Errorf("unexpected model type") |
| 361 | } |
| 362 | |
| 363 | if result.err != nil { |
| 364 | return "", result.err |
| 365 | } |
| 366 | |
| 367 | if result.success { |
| 368 | return result.successMsg, nil |
| 369 | } |
| 370 | |
| 371 | return "", nil |
| 372 | } |
no test coverage detected