diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-26 22:43:48 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-26 22:43:48 -0800 |
commit | 7d20672846065c9323d71be71a778d0bfd86248b (patch) | |
tree | bfae5a7701af666580b2d76d1c6f1927c4c00fc2 /cmd/ponzu/generate.go | |
parent | 2cb0895c222caa67a66016f2a9a16ca8c701b7f1 (diff) |
simplify generateContentType signature and using local path of template
Diffstat (limited to 'cmd/ponzu/generate.go')
-rw-r--r-- | cmd/ponzu/generate.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/ponzu/generate.go b/cmd/ponzu/generate.go index 9325d1d..c2c4237 100644 --- a/cmd/ponzu/generate.go +++ b/cmd/ponzu/generate.go @@ -132,7 +132,7 @@ func isHyphen(char rune) bool { return char == '-' } -func generateContentType(args []string, path string) error { +func generateContentType(args []string) error { name := args[0] fileName := strings.ToLower(name) + ".go" @@ -143,10 +143,6 @@ func generateContentType(args []string, path string) error { return err } - if path != "" { - pwd = path - } - contentDir := filepath.Join(pwd, "content") filePath := filepath.Join(contentDir, fileName) @@ -167,7 +163,8 @@ func generateContentType(args []string, path string) error { return fmt.Errorf("Failed to parse type args: %s", err.Error()) } - tmpl, err := template.ParseFiles("contentType.tmpl") + tmplPath := filepath.Join(pwd, "cmd", "ponzu", "contentType.tmpl") + tmpl, err := template.ParseFiles(tmplPath) if err != nil { return fmt.Errorf("Failed to parse template: %s", err.Error()) } |