(msg tea.Msg)
| 33 | } |
| 34 | |
| 35 | func (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 | |
| 62 | func (m ExecModel) View() string { |
| 63 | // lipgloss will format the layout for you |
nothing calls this directly
no test coverage detected