error if empty editor
This commit is contained in:
parent
c4ee8e7b04
commit
b18ea5ff7b
|
@ -1,6 +1,7 @@
|
||||||
package editor
|
package editor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -18,6 +19,10 @@ type Editor struct {
|
||||||
func (e *Editor) EditFile(filename string) error {
|
func (e *Editor) EditFile(filename string) error {
|
||||||
args := append(e.Args, filename)
|
args := append(e.Args, filename)
|
||||||
|
|
||||||
|
if e.Command == "" {
|
||||||
|
return fmt.Errorf("no editor set or detected")
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command(e.Command, args...)
|
cmd := exec.Command(e.Command, args...)
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
|
|
Loading…
Reference in a new issue