glow/ui/editor.go
Carlos Alexandro Becker 8b5468468a
fix: improve editor handling (#449)
* fix: improve editor handling

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* test: add tests

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-01-24 14:51:11 -03:00

15 lines
305 B
Go

package ui
import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/glow/editor"
)
type editorFinishedMsg struct{ err error }
func openEditor(path string) tea.Cmd {
cb := func(err error) tea.Msg {
return editorFinishedMsg{err}
}
return tea.ExecProcess(editor.Cmd(path), cb)
}