(msg tea.Msg)
| 25 | func (m profilesModel) Init() tea.Cmd { return nil } |
| 26 | |
| 27 | func (m profilesModel) Update(msg tea.Msg) (profilesModel, tea.Cmd) { |
| 28 | cfg := m.app.cfg |
| 29 | switch msg := msg.(type) { |
| 30 | case tea.KeyMsg: |
| 31 | if cfg == nil { |
| 32 | return m, nil |
| 33 | } |
| 34 | switch msg.String() { |
| 35 | case "up", "k": |
| 36 | if m.cursor > 0 { |
| 37 | m.cursor-- |
| 38 | } |
| 39 | case "down", "j": |
| 40 | if m.cursor < len(cfg.Profiles)-1 { |
| 41 | m.cursor++ |
| 42 | } |
| 43 | case "enter": |
| 44 | return m, m.setActive(cfg.Profiles[m.cursor].Name) |
| 45 | case "e": |
| 46 | return m, m.editExternal() |
| 47 | case "r": |
| 48 | return m, func() tea.Msg { return configReloadMsg{} } |
| 49 | } |
| 50 | } |
| 51 | return m, nil |
| 52 | } |
| 53 | |
| 54 | func (m profilesModel) View() string { |
| 55 | cfg := m.app.cfg |
nothing calls this directly
no test coverage detected