fix(cmd): import format (#2735)

pull/2739/head
jessetang 2 years ago committed by GitHub
parent ae4dd7f4a8
commit 492248d032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/kratos/internal/project/new.go
  2. 4
      cmd/kratos/internal/proto/client/client.go
  3. 4
      cmd/kratos/internal/proto/proto.go
  4. 4
      cmd/kratos/internal/upgrade/upgrade.go
  5. 4
      cmd/kratos/main.go

@ -6,10 +6,10 @@ import (
"os" "os"
"path" "path"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
"github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
) )
// Project is a project template. // Project is a project template.
@ -23,11 +23,11 @@ func (p *Project) New(ctx context.Context, dir string, layout string, branch str
to := path.Join(dir, p.Name) to := path.Join(dir, p.Name)
if _, err := os.Stat(to); !os.IsNotExist(err) { if _, err := os.Stat(to); !os.IsNotExist(err) {
fmt.Printf("🚫 %s already exists\n", p.Name) fmt.Printf("🚫 %s already exists\n", p.Name)
override := false
prompt := &survey.Confirm{ prompt := &survey.Confirm{
Message: "📂 Do you want to override the folder ?", Message: "📂 Do you want to override the folder ?",
Help: "Delete the existing folder and create the project.", Help: "Delete the existing folder and create the project.",
} }
var override bool
e := survey.AskOne(prompt, &override) e := survey.AskOne(prompt, &override)
if e != nil { if e != nil {
return e return e

@ -8,9 +8,9 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
) )
// CmdClient represents the source command. // CmdClient represents the source command.

@ -1,11 +1,11 @@
package proto package proto
import ( import (
"github.com/spf13/cobra"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/add" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/add"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/client" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/client"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/server" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto/server"
"github.com/spf13/cobra"
) )
// CmdProto represents the proto command. // CmdProto represents the proto command.

@ -3,9 +3,9 @@ package upgrade
import ( import (
"fmt" "fmt"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/base"
) )
// CmdUpgrade represents the upgrade command. // CmdUpgrade represents the upgrade command.

@ -3,13 +3,13 @@ package main
import ( import (
"log" "log"
"github.com/spf13/cobra"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/change" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/change"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/project" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/project"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/proto"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/run" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/run"
"github.com/go-kratos/kratos/cmd/kratos/v2/internal/upgrade" "github.com/go-kratos/kratos/cmd/kratos/v2/internal/upgrade"
"github.com/spf13/cobra"
) )
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{

Loading…
Cancel
Save