forked from mirror/cobra
vgo - add command working
This commit is contained in:
parent
3c42f846c2
commit
2fea75b02e
|
@ -98,10 +98,11 @@ func (c *Command) Create() error {
|
||||||
defer cmdFile.Close()
|
defer cmdFile.Close()
|
||||||
|
|
||||||
commandTemplate := template.Must(template.New("sub").Parse(string(tpl.AddCommandTemplate())))
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewProject returns Project with specified project name.
|
// NewProject returns Project with specified project name.
|
||||||
|
|
|
@ -110,8 +110,8 @@ func initConfig() {
|
||||||
|
|
||||||
func AddCommandTemplate() []byte {
|
func AddCommandTemplate() []byte {
|
||||||
return []byte(`/*
|
return []byte(`/*
|
||||||
{{ .Copyright }}
|
{{ .Project.Copyright }}
|
||||||
{{ if .Legal.Header }}{{ .Legal.Header }}{{ end }}
|
{{ if .Project.Legal.Header }}{{ .Project.Legal.Header }}{{ end }}
|
||||||
*/
|
*/
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue