(instances []string)
| 218 | } |
| 219 | |
| 220 | func RunConnect(instances []string) (string, error) { |
| 221 | ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) |
| 222 | defer stop() |
| 223 | |
| 224 | InitCommonStyles(os.Stdout) |
| 225 | |
| 226 | m := newConnectModel(instances) |
| 227 | p := tea.NewProgram( |
| 228 | m, |
| 229 | tea.WithContext(ctx), |
| 230 | tea.WithOutput(os.Stdout), |
| 231 | ) |
| 232 | |
| 233 | finalModel, err := p.Run() |
| 234 | if err != nil { |
| 235 | return "", fmt.Errorf("error running connect TUI: %w", err) |
| 236 | } |
| 237 | |
| 238 | result, ok := finalModel.(connectModel) |
| 239 | if !ok { |
| 240 | return "", fmt.Errorf("unexpected model type") |
| 241 | } |
| 242 | |
| 243 | if result.cancelled { |
| 244 | return "", ErrCancelled |
| 245 | } |
| 246 | return result.selected, nil |
| 247 | } |
| 248 | |
| 249 | func RunConnectInteractiveSelect(client *api.Client) (string, error) { |
| 250 | ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) |
nothing calls this directly
no test coverage detected