mirror of
https://github.com/charmbracelet/glow
synced 2024-12-12 13:12:32 +00:00
fce3edf7db
* feat!: cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * more cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: more cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: more cleanup --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
19 lines
390 B
Go
19 lines
390 B
Go
package ui
|
|
|
|
import (
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/charmbracelet/x/editor"
|
|
)
|
|
|
|
type editorFinishedMsg struct{ err error }
|
|
|
|
func openEditor(path string) tea.Cmd {
|
|
cb := func(err error) tea.Msg {
|
|
return editorFinishedMsg{err}
|
|
}
|
|
cmd, err := editor.Cmd("Glow", path)
|
|
if err != nil {
|
|
return func() tea.Msg { return cb(err) }
|
|
}
|
|
return tea.ExecProcess(cmd, cb)
|
|
}
|