From 2fea75b02e2e18fab31f754b0f014944b3d9e42d Mon Sep 17 00:00:00 2001 From: jharshman Date: Wed, 30 Jan 2019 01:44:39 -0800 Subject: [PATCH] vgo - add command working --- cobra/cmd/project.go | 3 ++- cobra/tpl/main.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cobra/cmd/project.go b/cobra/cmd/project.go index 3f7a4c8f..9f8dba90 100644 --- a/cobra/cmd/project.go +++ b/cobra/cmd/project.go @@ -98,10 +98,11 @@ func (c *Command) Create() error { defer cmdFile.Close() commandTemplate := template.Must(template.New("sub").Parse(string(tpl.AddCommandTemplate()))) - err = commandTemplate.Execute(cmdFile, c.Project.AbsolutePath) + err = commandTemplate.Execute(cmdFile, c) if err != nil { return err } + return nil } // NewProject returns Project with specified project name. diff --git a/cobra/tpl/main.go b/cobra/tpl/main.go index ba4d7cc5..71f1f450 100644 --- a/cobra/tpl/main.go +++ b/cobra/tpl/main.go @@ -110,8 +110,8 @@ func initConfig() { func AddCommandTemplate() []byte { return []byte(`/* -{{ .Copyright }} -{{ if .Legal.Header }}{{ .Legal.Header }}{{ end }} +{{ .Project.Copyright }} +{{ if .Project.Legal.Header }}{{ .Project.Legal.Header }}{{ end }} */ package cmd