blob: 5a9b69ff77a749d3139c6cbfc2488f918b172afb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package main
import (
"os"
"os/exec"
tea "charm.land/bubbletea/v2"
)
type editorFinishedMsg struct {
err error
}
func openEditor(path string) tea.Cmd {
editor := os.Getenv("EDITOR")
if editor == "" {
editor = "vim"
}
return tea.ExecProcess(exec.Command(editor, path), func(err error) tea.Msg {
return editorFinishedMsg{err: err}
})
}
|