Adds two task commands that can be used to generate the stubs for cmds for the cli:
* cli:generate: generates a new cli cmd
* cli:generate:ro: generates a new cli cmd with only the read cmds
If you want to generate all CRUD operations:
ask cli:generate
task: [cli:generate] go run gencmd/generate/main.go generate
Name of the command (should be the singular version of the object): MattIsTheBest
----> creating cli cmd for: MattIsTheBest
----> executing template: create.tmpl
----> executing template: delete.tmpl
----> executing template: doc.tmpl
----> executing template: get.tmpl
----> executing template: root.tmpl
----> executing template: update.tmpl
Which creates:
ls -l cmd/cli/cmd/mattisthebest/
total 48
-rw-r--r-- 1 sarahfunkhouser staff 1261 Jun 27 13:30 create.go
-rw-r--r-- 1 sarahfunkhouser staff 1086 Jun 27 13:30 delete.go
-rw-r--r-- 1 sarahfunkhouser staff 102 Jun 27 13:30 doc.go
-rw-r--r-- 1 sarahfunkhouser staff 1079 Jun 27 13:30 get.go
-rw-r--r-- 1 sarahfunkhouser staff 2570 Jun 27 13:30 root.go
-rw-r--r-- 1 sarahfunkhouser staff 1511 Jun 27 13:30 update.go
For Read-Only cmds, only the get stub is created
task cli:generate:ro
task: [cli:generate:ro] go run gencmd/generate/main.go generate --read-only
Name of the command (should be the singular version of the object): MattIsTheBestHistory
----> creating cli cmd for: MattIsTheBestHistory
----> executing template: doc.tmpl
----> executing template: get.tmpl
----> executing template: root.tmpl
Once created, you still need to go update:
the flags and field validation for create and update
Adds two task commands that can be used to generate the stubs for cmds for the cli:
If you want to generate all CRUD operations:
Which creates:
For
Read-Only
cmds, only theget
stub is createdOnce created, you still need to go update:
main.go
fileroot.go