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

Method Update

internal/ui/repoInput.go:55–81  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

53}
54
55func (m InitialModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
56 var cmd tea.Cmd
57
58 switch msg := msg.(type) {
59 case tea.KeyMsg:
60 switch msg.Type {
61 case tea.KeyCtrlC, tea.KeyEsc:
62 return m, tea.Quit
63 case tea.KeyEnter:
64 // save value to global so it doesn't get lost
65 // or you can wrap it as a tea.Msg and send it to the spinnerView to get handled
66 RepoName = strings.TrimSpace(m.textInput.Value()) // QOL addition to remove spaces so that the directory formed is `helix` and
67 // not `helix\ /`
68 if RepoName == "" {
69 return m, nil
70 }
71 m := NewExecModel(strings.ToLower(RepoName))
72 return m, m.Init()
73 }
74
75 case errMsg:
76 m.err = msg
77 }
78
79 m.textInput, cmd = m.textInput.Update(msg)
80 return m, cmd
81}
82
83func (m InitialModel) View() string {
84 // lipgloss will format the layout for you

Callers

nothing calls this directly

Calls 2

InitMethod · 0.95
NewExecModelFunction · 0.85

Tested by

no test coverage detected