(msg tea.Msg)
| 53 | } |
| 54 | |
| 55 | func (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 | |
| 83 | func (m InitialModel) View() string { |
| 84 | // lipgloss will format the layout for you |
nothing calls this directly
no test coverage detected