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

Method editExternal

tui/profiles.go:180–192  ·  view source on GitHub ↗

editExternal opens the config file in $EDITOR and returns control to the TUI after the editor exits. On Windows we fall back to notepad.

()

Source from the content-addressed store, hash-verified

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.
180func (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).
195func writeYAML(path string, cfg *config.Config) error {

Callers 1

UpdateMethod · 0.95

Calls 2

statusMsgTypeAlias · 0.85
defaultEditorFunction · 0.70

Tested by

no test coverage detected