diff options
-rw-r--r-- | README.md | 21 | ||||
-rw-r--r-- | cmd/ponzu/main.go | 1 | ||||
-rw-r--r-- | cmd/ponzu/usage.go | 11 |
3 files changed, 12 insertions, 21 deletions
@@ -80,22 +80,17 @@ Errors will be reported, but successful commands return nothing. ### generate, gen, g -Generate a content type file with boilerplate code to implement -the editor.Editable interface. Must be given one (1) parameter of -the name of the type for the new content. The fields following a -type determine the field names and types of the content struct to -be generated. These must be in the following format: -fieldName:"T" +Generate boilerplate code for various Ponzu components, such as `content`. Example: ```bash - struct fields and built-in types... - | - v -$ ponzu gen review title:"string" body:"string" rating:"int" tags:"[]string" - ^ - | - struct type + generator struct fields and built-in types... + | | + v v +$ ponzu gen content review title:"string" body:"string" rating:"int" tags:"[]string" + ^ + | + struct type ``` The command above will generate the file `content/review.go` with boilerplate diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index b07a249..d2ec4d8 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -99,6 +99,7 @@ func main() { // check what we are asked to generate switch args[2] { case "content", "c": + fmt.Println(args, "|", args[2]) err := generateContentType(args[2:]) if err != nil { fmt.Println(err) diff --git a/cmd/ponzu/usage.go b/cmd/ponzu/usage.go index ee69cf4..2d7a3b8 100644 --- a/cmd/ponzu/usage.go +++ b/cmd/ponzu/usage.go @@ -54,17 +54,12 @@ new <directory>: ` var usageGenerate = ` -generate, gen, g <type (,...fields)>: +generate, gen, g <generator type (,...fields)>: - Generate a content type file with boilerplate code to implement - the editor.Editable interface. Must be given one (1) parameter of - the name of the type for the new content. The fields following a - type determine the field names and types of the content struct to - be generated. These must be in the following format: - fieldName:"T" + Generate boilerplate code for various Ponzu components, such as 'content'. Example: - $ ponzu gen review title:"string" body:"string" rating:"int" tags:"[]string" + $ ponzu gen content review title:"string" body:"string" rating:"int" tags:"[]string" The command above will generate a file 'content/review.go' with boilerplate methods, as well as struct definition, and cooresponding field tags like: |