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 | |
parent | 2cb0895c222caa67a66016f2a9a16ca8c701b7f1 (diff) |
simplify generateContentType signature and using local path of template
-rw-r--r-- | cmd/ponzu/generate.go | 9 | ||||
-rw-r--r-- | cmd/ponzu/main.go | 2 |
2 files changed, 4 insertions, 7 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()) } diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index 88355f4..2a60507 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -120,7 +120,7 @@ func main() { os.Exit(0) } - err := generateContentType(args[1:], "") + err := generateContentType(args[1:]) if err != nil { fmt.Println(err) os.Exit(1) |