MCPcopy
hub / github.com/charmbracelet/bubbletea / Update

Method Update

examples/http/main.go:38–59  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

36}
37
38func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
39 switch msg := msg.(type) {
40 case tea.KeyPressMsg:
41 switch msg.String() {
42 case "q", "ctrl+c", "esc":
43 return m, tea.Quit
44 default:
45 return m, nil
46 }
47
48 case statusMsg:
49 m.status = int(msg)
50 return m, tea.Quit
51
52 case errMsg:
53 m.err = msg
54 return m, nil
55
56 default:
57 return m, nil
58 }
59}
60
61func (m model) View() tea.View {
62 s := fmt.Sprintf("Checking %s...", url)

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected