MCPcopy Create free account
hub / github.com/SamNet-dev/snix / Update

Method Update

tui/profiles.go:27–52  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

25func (m profilesModel) Init() tea.Cmd { return nil }
26
27func (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
54func (m profilesModel) View() string {
55 cfg := m.app.cfg

Callers

nothing calls this directly

Calls 3

setActiveMethod · 0.95
editExternalMethod · 0.95
StringMethod · 0.80

Tested by

no test coverage detected