MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / RunConnect

Function RunConnect

tui/connect.go:220–247  ·  view source on GitHub ↗
(instances []string)

Source from the content-addressed store, hash-verified

218}
219
220func 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
249func RunConnectInteractiveSelect(client *api.Client) (string, error) {
250 ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)

Callers

nothing calls this directly

Calls 2

InitCommonStylesFunction · 0.85
newConnectModelFunction · 0.85

Tested by

no test coverage detected