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

Method setActive

tui/profiles.go:161–176  ·  view source on GitHub ↗

setActive writes the new active profile to disk, then asks the app to reload.

(name string)

Source from the content-addressed store, hash-verified

159
160// setActive writes the new active profile to disk, then asks the app to reload.
161func (m profilesModel) setActive(name string) tea.Cmd {
162 cfg := m.app.cfg
163 if cfg == nil {
164 return setStatus("no config loaded")
165 }
166 cfg.Active = name
167 return func() tea.Msg {
168 if err := writeYAML(m.app.opts.ConfigPath, cfg); err != nil {
169 return statusMsg(fmt.Sprintf("write failed: %v", err))
170 }
171 return tea.Sequence(
172 setStatus("active profile set to %q", name),
173 func() tea.Msg { return configReloadMsg{} },
174 )()
175 }
176}
177
178// editExternal opens the config file in $EDITOR and returns control to the
179// TUI after the editor exits. On Windows we fall back to notepad.

Callers 1

UpdateMethod · 0.95

Calls 3

setStatusFunction · 0.85
writeYAMLFunction · 0.85
statusMsgTypeAlias · 0.85

Tested by

no test coverage detected