This commit is contained in:
许 洋 2024-08-08 10:01:04 +08:00
parent fb13c5ef96
commit 8ecb9e962d
2 changed files with 12 additions and 2 deletions

10
go.sum Normal file
View File

@ -0,0 +1,10 @@
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

View File

@ -25,7 +25,7 @@ func main() {
flag.StringVar(&localTemplatePath, "local", "", "本地模板路径") flag.StringVar(&localTemplatePath, "local", "", "本地模板路径")
flag.StringVar(&remoteTemplatePath, "remote", "", "远程仓库url") flag.StringVar(&remoteTemplatePath, "remote", "", "远程仓库url")
flag.StringVar(&projectName, "name", "", "项目名称") flag.StringVar(&projectName, "name", "", "项目名称")
flag.StringVar(&branch, "branch", "main", "要使用的分支(仅当模板是远程仓库时)") flag.StringVar(&branch, "branch", "master", "要使用的分支(仅当模板是远程仓库时)")
flag.Parse() flag.Parse()
if localTemplatePath == "" && remoteTemplatePath == "" { if localTemplatePath == "" && remoteTemplatePath == "" {
@ -93,7 +93,7 @@ func handleRemoteTemplate(templateRepo, branch, projectName string, replacements
func getReplacements() map[string]string { func getReplacements() map[string]string {
scanner := bufio.NewScanner(os.Stdin) scanner := bufio.NewScanner(os.Stdin)
replacements := make(map[string]string) replacements := make(map[string]string)
fmt.Println("输入替换值(key=value),空行结束: ") fmt.Println("输入替换值(key=value),空行回车结束: ")
for { for {
fmt.Print("> ") fmt.Print("> ")
scanner.Scan() scanner.Scan()