mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-24 03:46:37 +02:00
add layout env (#897)
This commit is contained in:
parent
2e4bb11f00
commit
eed0ac7d4a
@ -17,10 +17,13 @@ var CmdNew = &cobra.Command{
|
||||
Run: run,
|
||||
}
|
||||
|
||||
var repoUrl string
|
||||
var repoURL string
|
||||
|
||||
func init() {
|
||||
CmdNew.Flags().StringVarP(&repoUrl, "-repo-url", "r", "https://github.com/go-kratos/kratos-layout.git", "layout repo")
|
||||
if repoURL = os.Getenv("KRATOS_LAYOUT_REPO"); repoURL == "" {
|
||||
repoURL = "https://github.com/go-kratos/kratos-layout.git"
|
||||
}
|
||||
CmdNew.Flags().StringVarP(&repoURL, "-repo-url", "r", repoURL, "layout repo")
|
||||
}
|
||||
|
||||
func run(cmd *cobra.Command, args []string) {
|
||||
@ -35,7 +38,7 @@ func run(cmd *cobra.Command, args []string) {
|
||||
return
|
||||
}
|
||||
p := &Project{Name: args[0]}
|
||||
if err := p.New(ctx, wd, repoUrl); err != nil {
|
||||
if err := p.New(ctx, wd, repoURL); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err)
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user