(client *api.Client)
| 365 | } |
| 366 | |
| 367 | func RunSnapshotCreateInteractive(client *api.Client) (*SnapshotCreateConfig, error) { |
| 368 | InitCommonStyles(os.Stdout) |
| 369 | m := NewSnapshotCreateModel(client) |
| 370 | p := tea.NewProgram(m) |
| 371 | finalModel, err := p.Run() |
| 372 | if err != nil { |
| 373 | return nil, fmt.Errorf("error running TUI: %w", err) |
| 374 | } |
| 375 | |
| 376 | result, ok := finalModel.(snapshotCreateModel) |
| 377 | if !ok { |
| 378 | return nil, fmt.Errorf("unexpected model type") |
| 379 | } |
| 380 | |
| 381 | if result.err != nil { |
| 382 | return nil, result.err |
| 383 | } |
| 384 | |
| 385 | if result.quitting || !result.config.Confirmed { |
| 386 | return nil, ErrCancelled |
| 387 | } |
| 388 | |
| 389 | return &result.config, nil |
| 390 | } |
no test coverage detected