Inspired by boiler, codectl is a templating tool powered by Go templates. It is designed to generate boilerplate starting points for new projects based on a predefined template.
- Go Templates - Built around Go templates, a powerful data-driven templating engine
- Repositories - Supports template repositories by pulling templates from Github repositories and storing them locally
- Parameter Definitions - Provides powerful template definitions that allow for specifying parameters to prompt for when generating
Currently, codectl can be installed by using go get:
$ go get -u github.com/thmhoag/codectl/cmd/codectlIn the future, codectl will be available as a self-contained binary via Github releases.
For a list of commands, you can start with codectl --help.
Currently, codectl supports Github repositories as template repositories.
To add a new repository, simply provide a repository name and a fully qualified URL to the Github repo:
$ codectl repo add default https://github.com/thmhoag/codectl-templatesAdditionally, you can specify a specific folder of the repository by using // to denote that it is a folder off the root:
$ codectl repo add default https://github.com/thmhoag/codectl//templatesAnd now you can list the repos to verify it has been added:
$ codectl repo lsTemplate repositories are downloaded and cached from their sources. Once a repository has been added, the cache must be updated to reflect the change:
$ codectl repo updateNOTE: At this time, codectl only supports Github.com. In the future it will support Github Enterprise, as well as other remote sources.
List available templates:
$ codectl template lsChoose a template name, then generate it:
$ codectl generate default.go.clicodectl should now prompt for any required parameters for the template chosen, and generate the output to the current directory.
To specify a different output directory, use the output flag:
$ codectl generate default.go.cli -o ./my-desired-output