mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-07 23:02:12 +02:00
* fix: fixed kratos "new" command
This commit is contained in:
parent
5559923193
commit
41ad9061db
@ -15,6 +15,7 @@ import (
|
||||
// Project is a project template.
|
||||
type Project struct {
|
||||
Name string
|
||||
Path string
|
||||
}
|
||||
|
||||
// New new a project from remote repo.
|
||||
@ -36,7 +37,7 @@ func (p *Project) New(ctx context.Context, dir string, layout string, branch str
|
||||
}
|
||||
fmt.Printf("🚀 Creating service %s, layout repo is %s, please wait a moment.\n\n", p.Name, layout)
|
||||
repo := base.NewRepo(layout, branch)
|
||||
if err := repo.CopyTo(ctx, to, p.Name, []string{".git", ".github"}); err != nil {
|
||||
if err := repo.CopyTo(ctx, to, p.Path, []string{".git", ".github"}); err != nil {
|
||||
return err
|
||||
}
|
||||
os.Rename(
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
@ -49,7 +50,7 @@ func run(cmd *cobra.Command, args []string) {
|
||||
} else {
|
||||
name = args[0]
|
||||
}
|
||||
p := &Project{Name: name}
|
||||
p := &Project{Name: path.Base(name), Path: name}
|
||||
if err := p.New(ctx, wd, repoURL, branch); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "\033[31mERROR: %s\033[m\n", err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user