editExternal opens the config file in $EDITOR and returns control to the TUI after the editor exits. On Windows we fall back to notepad.
()
| 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. |
| 180 | func (m profilesModel) editExternal() tea.Cmd { |
| 181 | editor := os.Getenv("EDITOR") |
| 182 | if editor == "" { |
| 183 | editor = defaultEditor() |
| 184 | } |
| 185 | cmd := exec.Command(editor, m.app.opts.ConfigPath) |
| 186 | return tea.ExecProcess(cmd, func(err error) tea.Msg { |
| 187 | if err != nil { |
| 188 | return statusMsg(fmt.Sprintf("editor exited: %v", err)) |
| 189 | } |
| 190 | return configReloadMsg{} |
| 191 | }) |
| 192 | } |
| 193 | |
| 194 | // writeYAML serialises cfg to path atomically (tmp file + rename). |
| 195 | func writeYAML(path string, cfg *config.Config) error { |
no test coverage detected