MCPcopy Create free account
hub / github.com/LunaSource/Luna / Update

Method Update

config/config.go:155–180  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

153 cfg.Model = model
154 }
155 SaveGlobalConfig(cfg)
156 }
157 }
158}
159
160type model struct {
161 list list.Model
162 selected []string
163 quitting bool
164}
165
166func (m model) Init() tea.Cmd {
167 return nil
168}
169
170func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
171 switch msg := msg.(type) {
172 case tea.KeyMsg:
173 switch key := msg.String(); key {
174 case "ctrl+c", "q":
175 m.quitting = true
176 return m, tea.Quit
177 case " ":
178 selectedItem := m.list.SelectedItem().(configItem)
179 if contains(m.selected, selectedItem.value) {
180 m.selected = remove(m.selected, selectedItem.value)
181 } else {
182 m.selected = append(m.selected, selectedItem.value)
183 }

Callers

nothing calls this directly

Calls 2

containsFunction · 0.85
removeFunction · 0.85

Tested by

no test coverage detected