diff options
Diffstat (limited to 'create/content.go')
-rw-r--r-- | create/content.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/create/content.go b/create/content.go index f1a2a3350..c3c1747a2 100644 --- a/create/content.go +++ b/create/content.go @@ -17,6 +17,8 @@ import ( "bytes" "io/ioutil" "os" + "os/exec" + "path" "path/filepath" "strings" "time" @@ -104,6 +106,21 @@ func NewContent(kind, name string) (err error) { } jww.FEEDBACK.Println(helpers.AbsPathify(filepath.Join(viper.GetString("contentDir"), name)), "created") + editor := viper.GetString("NewContentEditor") + + if editor != "" { + jww.FEEDBACK.Printf("Editing %s in %s.\n", name, editor) + + cmd := exec.Command(editor, path.Join(viper.GetString("contentDir"), name)) + cmd.Stdin = os.Stdin + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + if err = cmd.Run(); err != nil { + return + } + } + return nil } |