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

  1. $ goctl template --help
  2. Template operation
  3. Usage:
  4. goctl template [command]
  5. Available Commands:
  6. clean Clean the all cache templates
  7. init Initialize the all templates(force update)
  8. revert Revert the target template to the latest
  9. update Update template of the target category to the latest
  10. Flags:
  11. -h, --help help for template
  12. 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.

  1. $ goctl template clean --help
  2. Clean the all cache templates
  3. Usage:
  4. goctl template clean [flags]
  5. Flags:
  6. -h, --help help for clean
  7. --home string The goctl home path of the template

goctl template init directive

goctl template init for initialization templates, which store template files locally.

  1. $ goctl template init --help
  2. Initialize the all templates(force update)
  3. Usage:
  4. goctl template init [flags]
  5. Flags:
  6. -h, --help help for init
  7. --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.

  1. $ goctl template revert --help
  2. Revert the target template to the latest
  3. Usage:
  4. goctl template revert [flags]
  5. Flags:
  6. -c, --category string The category of template, enum [api,rpc,model,docker,kube]
  7. -h, --help help for revert
  8. --home string The goctl home path of the template
  9. -n, --name string The target file name of template
goctl template - 图1 Parameter fieldgoctl template - 图2 Parameter Typegoctl template - 图3 Required?goctl template - 图4 Default valuegoctl template - 图5 Parameter Description
categorystringYESEmpty string模板分类,api|rpc|model|docker|kube
homestringYES${HOME}/.goctlFile location stored in template
namestringYESEmpty stringTemplate File Name

goctl template update instruction

goctl template update is used to roll back all template files under a category.

  1. $ goctl template update --help
  2. Update template of the target category to the latest
  3. Usage:
  4. goctl template update [flags]
  5. Flags:
  6. -c, --category string The category of template, enum [api,rpc,model,docker,kube]
  7. -h, --help help for update
  8. --home string The goctl home path of the template
goctl template - 图6 Parameter fieldgoctl template - 图7 Parameter Typegoctl template - 图8 Required?goctl template - 图9 Default valuegoctl template - 图10 Parameter Description
categorystringYESEmpty stringTemplate Category,api|rpc|model|docker|kube
homestringYES${HOME}/.goctlFile location stored in template