Generate Service source code based on a project and a solution
The ol templates edit command enables you to edit prepackaged templates with the generator plugins installed on your local CLI tool.
When you edit a template, a local copy of the template is created on your machine. You can then open the template file in a code editor and apply your custom changes to the template code.
To edit a template, perform the following steps:
- Display the template list (see ol list templates).
temp> ol list templates
temp$ ol list templates
- Copy the name of the template you want to edit.
- Run ol templates edit with the name of the template you want to edit as an argument.
temp> ol templates edit java-spring-main-class.ftl
temp$ ol templates edit java-spring-main-class.ftl
The template you selected is created in /Users/[username]/.ol/cli/templates/
The original template is removed from the template list.
- Open the newly created template copy in a code editor and apply your changes.
Skip template
You can determine which files will comprise your generated service by specifying to generate service which templates not to include in the service generation process. To learn more, see generate service --skip and --skip-all options.
Syntax
ol templates edit TEMPLATE [OPTIONS]
Arguments
TEMPLATE
The name of the template to edit
Options
--force, -f
Force override the custom template.
--templates-path
The destination folder to store custom templates (default: /.ol/cli/templates/).
Examples
Editing a template
> ol templates edit pom.ftl
$ ol templates edit pom.ftl
Force override a custom template in a custom path
> ol templates edit pom.ftl --force --templates-path ./templates
$ ol templates edit pom.ftl --force --templates-path ./templates