MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / Update

Method Update

internal/cli/provider_wizard.go:195–250  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

193func (m providerWizardModel) Init() tea.Cmd { return nil }
194
195func (m providerWizardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
196 key, ok := msg.(tea.KeyMsg)
197 if !ok {
198 return m, nil
199 }
200
201 var action pickerAction
202 switch m.phase {
203 case wizPhaseName:
204 action = m.nameStep.update(key)
205 case wizPhaseEndpoint:
206 action = m.endpointStep.update(key)
207 case wizPhaseAPIKeyEnv:
208 action = m.apiKeyEnvStep.update(key)
209 case wizPhaseClients:
210 action = m.clientsStep.update(key)
211 case wizPhaseModels:
212 action = m.modelsStep.update(key)
213 case wizPhaseListModelsCmd:
214 action = m.listModelsCmdStep.update(key)
215 case wizPhaseDescription:
216 action = m.descriptionStep.update(key)
217 case wizPhaseUseProxy:
218 action = m.useProxyStep.update(key)
219 case wizPhaseKeepProxy:
220 action = m.keepProxyStep.update(key)
221 case wizPhaseEnabled:
222 action = m.enabledStep.update(key)
223 default:
224 return m, nil
225 }
226
227 switch action {
228 case pickerActionAbort:
229 m.aborted = true
230 return m, tea.Quit
231 case pickerActionBack:
232 m.stepBack()
233 return m, nil
234 case pickerActionAdvance:
235 if m.phase == wizPhaseName {
236 name := m.nameStep.selected()
237 if m.existingNames[name] {
238 m.nameStep.errMsg = fmt.Sprintf("Provider %q already exists", name)
239 return m, nil
240 }
241 }
242 m.advance()
243 if m.phase == wizPhaseDone {
244 return m, tea.Quit
245 }
246 return m, nil
247 }
248
249 return m, nil
250}
251
252func (m providerWizardModel) View() string {

Callers

nothing calls this directly

Calls 4

stepBackMethod · 0.95
advanceMethod · 0.95
updateMethod · 0.45
selectedMethod · 0.45

Tested by

no test coverage detected