persist writes the current in-memory config back to disk and asks the app to reload so everything reflects the change.
()
| 191 | // persist writes the current in-memory config back to disk and asks the app |
| 192 | // to reload so everything reflects the change. |
| 193 | func (m settingsModel) persist() tea.Cmd { |
| 194 | return func() tea.Msg { |
| 195 | if err := writeYAML(m.app.opts.ConfigPath, m.app.cfg); err != nil { |
| 196 | return statusMsg(fmt.Sprintf("write failed: %v", err)) |
| 197 | } |
| 198 | return tea.Sequence( |
| 199 | setStatus("settings saved"), |
| 200 | func() tea.Msg { return configReloadMsg{} }, |
| 201 | )() |
| 202 | } |
| 203 | } |