goctl template
Overview
Template(s) are the basis for data driver’s generation; all codes (rest api, rpc, model, docker, kube) are generated by the template, By default, the template generator selects the template in memory and, for developers who need the template to modify the template, requires the template to be disked, to modify the template so that the template will be loaded from the specified path when the next code is generated.
goctl template directive
$ goctl template --help
Template operation
Usage:
goctl template [command]
Available Commands:
clean Clean the all cache templates
init Initialize the all templates(force update)
revert Revert the target template to the latest
update Update template of the target category to the latest
Flags:
-h, --help help for template
Use "goctl template [command] --help" for more information about a command.
goctl template clean directive
goctl template clean is used to delete persistent local template files.
$ goctl template clean --help
Clean the all cache templates
Usage:
goctl template clean [flags]
Flags:
-h, --help help for clean
--home string The goctl home path of the template
goctl template init directive
goctl template init for initialization templates, which store template files locally.
$ goctl template init --help
Initialize the all templates(force update)
Usage:
goctl template init [flags]
Flags:
-h, --help help for init
--home string The goctl home path of the template
goctl template revert directive
goctl template revert is used to roll back the specified template file in a category.
$ goctl template revert --help
Revert the target template to the latest
Usage:
goctl template revert [flags]
Flags:
-c, --category string The category of template, enum [api,rpc,model,docker,kube]
-h, --help help for revert
--home string The goctl home path of the template
-n, --name string The target file name of template
Parameter field | Parameter Type | Required? | Default value | Parameter Description |
---|---|---|---|---|
category | string | YES | Empty string | 模板分类,api|rpc|model|docker|kube |
home | string | YES | ${HOME}/.goctl | File location stored in template |
name | string | YES | Empty string | Template File Name |
goctl template update instruction
goctl template update is used to roll back all template files under a category.
$ goctl template update --help
Update template of the target category to the latest
Usage:
goctl template update [flags]
Flags:
-c, --category string The category of template, enum [api,rpc,model,docker,kube]
-h, --help help for update
--home string The goctl home path of the template
Parameter field | Parameter Type | Required? | Default value | Parameter Description |
---|---|---|---|---|
category | string | YES | Empty string | Template Category,api|rpc|model|docker|kube |
home | string | YES | ${HOME}/.goctl | File location stored in template |