MCPcopy Create free account
hub / github.com/catppuccin/cli / Update

Method Update

internal/ui/execInput.go:35–60  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

33}
34
35func (m ExecModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
36 var cmd tea.Cmd
37
38 switch msg := msg.(type) {
39 case tea.KeyMsg:
40 switch msg.Type {
41 case tea.KeyCtrlC, tea.KeyEsc:
42 return m, tea.Quit
43 case tea.KeyEnter:
44 // save value to global so it doesn't get lost
45 // or you can wrap it as a tea.Msg and send it to the spinnerView to get handled
46 ExecName = m.textInput.Value()
47 if ExecName == "" {
48 ExecName = m.textInput.Placeholder
49 }
50 m := NewInstallModel(m.textInput.Placeholder)
51 return m, m.Init()
52 }
53
54 case errMsg:
55 m.err = msg
56 }
57
58 m.textInput, cmd = m.textInput.Update(msg)
59 return m, cmd
60}
61
62func (m ExecModel) View() string {
63 // lipgloss will format the layout for you

Callers

nothing calls this directly

Calls 2

InitMethod · 0.95
NewInstallModelFunction · 0.85

Tested by

no test coverage detected