Crates.io | tgm |
lib.rs | tgm |
version | 0.10.0 |
source | src |
created_at | 2020-08-26 05:29:13.482786 |
updated_at | 2022-01-01 00:16:39.169282 |
description | CLI to manage template repositories |
homepage | https://github.com/linux-china/tgm |
repository | https://github.com/linux-china/tgm |
max_upload_size | |
id | 280867 |
size | 158,568 |
Generate project structure from git template repository.
Why tgm?
Please add template.json file in your template repository, code as following:
{
"name": "spring-boot-java",
"repository": "https://github.com/linux-china/spring-boot-java-template",
"description": "Spring Boot App Java",
"post_create": "mvn -DskipTests compile",
"variables": [
{
"name": "groupId",
"description": "Maven groupId"
},
{
"name": "artifactId",
"description": "Maven artifactId"
}
],
"files": [
"pom.xml","src/main/resources/application.properties"
]
}
Attention: You can add regex pattern validation for variable's value like following:
{
"name": "email",
"description": "author email",
"pattern": "[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}"
}
In the resource files, such as pom.xml, use template variable as following:
<project>
<groupId>@groupId@</groupId>
<artifactId>@artifactId@</artifactId>
</project>
default global variables:
$ cargo install tgm
$ tgm add linux-china/spring-boot-java-template
$ tgm list
$ tgm create spring-boot-java spring-app-demo
$ tgm add --name spring-boot-java --repo https://github.com/linux-china/spring-boot-java-template.git --desc "Spring Boot Java template"
$ tgm import linux-china/spring-boot-kotlin-template
$ tgm import https://github.com/linux-china/spring-boot-java-template
$ tgm remove spring-boot-java
$ tgm create spring-boot-java spring-demo1
$ tgm complete --oh_my_zsh
tgm will add tgm to plugins in ~/.zshrc.
$ tgm complete --bash > tgm-completion.bash
$ source ./tgm-completion.bash