diff options
author | Albert Nigmatzianov <albertnigma@gmail.com> | 2017-03-24 12:13:05 +0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-03-24 22:19:03 +0100 |
commit | a159feffb22f46edbad14495c9d0b0495cd21d39 (patch) | |
tree | 18b710c20015eabaaf71c98782fbecbf162eb75c /create | |
parent | d07ff9d221e036e11541b5b594a1a9c99a96c50f (diff) |
create: Delete redundant viper calls
Also make easier to read the code
Diffstat (limited to 'create')
-rw-r--r-- | create/content.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/create/content.go b/create/content.go index d38d3c7fb..5cab4289b 100644 --- a/create/content.go +++ b/create/content.go @@ -18,7 +18,6 @@ import ( "bytes" "os" "os/exec" - "path" "path/filepath" "strings" "time" @@ -72,17 +71,18 @@ func NewContent(s *hugolib.Site, kind, name string) (err error) { page.SetSourceContent(psr.Content()) - if err = page.SafeSaveSourceAs(filepath.Join(s.Cfg.GetString("contentDir"), name)); err != nil { + contentPath := s.PathSpec.AbsPathify(filepath.Join(s.Cfg.GetString("contentDir"), name)) + + if err = page.SafeSaveSourceAs(contentPath); err != nil { return } - jww.FEEDBACK.Println(s.PathSpec.AbsPathify(filepath.Join(s.Cfg.GetString("contentDir"), name)), "created") + jww.FEEDBACK.Println(contentPath, "created") editor := s.Cfg.GetString("newContentEditor") - if editor != "" { jww.FEEDBACK.Printf("Editing %s with %q ...\n", name, editor) - cmd := exec.Command(editor, s.PathSpec.AbsPathify(path.Join(s.Cfg.GetString("contentDir"), name))) + cmd := exec.Command(editor, contentPath) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr |