mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-02 16:28:39 +08:00
fix issue of default migrate version (#1536)
* fix issue of default migrate version * chore: update console colors
This commit is contained in:
parent
6ab051568c
commit
6deb80625d
@ -634,5 +634,3 @@ func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, in
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@ func Completion(c *cli.Context) error {
|
||||
if goos == vars.OsWindows {
|
||||
return fmt.Errorf("%q: only support unix-like OS", goos)
|
||||
}
|
||||
|
||||
name := c.String("name")
|
||||
if len(name) == 0 {
|
||||
name = defaultCompletionFilename
|
||||
@ -31,6 +32,7 @@ func Completion(c *cli.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
zshF := filepath.Join(home, "zsh", defaultCompletionFilename)
|
||||
err = pathx.MkdirIfNotExist(filepath.Dir(zshF))
|
||||
@ -43,7 +45,8 @@ func Completion(c *cli.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var flag = magic
|
||||
|
||||
flag := magic
|
||||
err = ioutil.WriteFile(zshF, zsh, os.ModePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -56,20 +59,21 @@ func Completion(c *cli.Context) error {
|
||||
}
|
||||
|
||||
flag |= flagBash
|
||||
buffer.WriteString(aurora.Green("generation auto completion success!\n").String())
|
||||
buffer.WriteString(aurora.Green("executes the following script to setting shell:\n").String())
|
||||
buffer.WriteString(aurora.BrightGreen("generation auto completion success!\n").String())
|
||||
buffer.WriteString(aurora.BrightGreen("executes the following script to setting shell:\n").String())
|
||||
switch flag {
|
||||
case magic | flagZsh:
|
||||
buffer.WriteString(aurora.Blue(fmt.Sprintf("echo PROG=goctl source %s >> ~/.zshrc && source ~/.zshrc", zshF)).String())
|
||||
buffer.WriteString(aurora.BrightCyan(fmt.Sprintf("echo PROG=goctl source %s >> ~/.zshrc && source ~/.zshrc", zshF)).String())
|
||||
case magic | flagBash:
|
||||
buffer.WriteString(aurora.Blue(fmt.Sprintf("echo PROG=goctl source %s >> ~/.bashrc && source ~/.bashrc", bashF)).String())
|
||||
buffer.WriteString(aurora.BrightCyan(fmt.Sprintf("echo PROG=goctl source %s >> ~/.bashrc && source ~/.bashrc", bashF)).String())
|
||||
case magic | flagZsh | flagBash:
|
||||
buffer.WriteString(aurora.Blue(fmt.Sprintf(`echo PROG=goctl source %s >> ~/.zshrc && source ~/.zshrc
|
||||
buffer.WriteString(aurora.BrightCyan(fmt.Sprintf(`echo PROG=goctl source %s >> ~/.zshrc && source ~/.zshrc
|
||||
or
|
||||
echo PROG=goctl source %s >> ~/.bashrc && source ~/.bashrc`, zshF, bashF)).String())
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Println(buffer.String())
|
||||
return nil
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/tools/goctl/vars"
|
||||
)
|
||||
|
||||
const zeromicroVersion = "1.3.0"
|
||||
const zeromicroVersion = "v1.3.0"
|
||||
|
||||
const (
|
||||
confirmUnknown = iota
|
||||
@ -57,8 +57,10 @@ func Migrate(c *cli.Context) error {
|
||||
}
|
||||
|
||||
if verbose {
|
||||
console.Success("[OK] refactor finish, execute %q on project root to check status.", "go test -race ./...")
|
||||
console.Success("[OK] refactor finish, execute %q on project root to check status.",
|
||||
"go test -race ./...")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,12 @@ import (
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util/ctx"
|
||||
)
|
||||
|
||||
const deprecatedGoZeroMod = "github.com/tal-tech/go-zero"
|
||||
const deprecatedBuilderx = "github.com/tal-tech/go-zero/tools/goctl/model/sql/builderx"
|
||||
const replacementBuilderx = "github.com/zeromicro/go-zero/core/stores/builder"
|
||||
const goZeroMod = "github.com/zeromicro/go-zero"
|
||||
const (
|
||||
deprecatedGoZeroMod = "github.com/tal-tech/go-zero"
|
||||
deprecatedBuilderx = "github.com/tal-tech/go-zero/tools/goctl/model/sql/builderx"
|
||||
replacementBuilderx = "github.com/zeromicro/go-zero/core/stores/builder"
|
||||
goZeroMod = "github.com/zeromicro/go-zero"
|
||||
)
|
||||
|
||||
var errInvalidGoMod = errors.New("it's only working for go module")
|
||||
|
||||
@ -38,11 +40,13 @@ func editMod(version string, verbose bool) error {
|
||||
if !stringx.Contains(latest, version) {
|
||||
return fmt.Errorf("release version %q is not found", version)
|
||||
}
|
||||
|
||||
mod := fmt.Sprintf("%s@%s", goZeroMod, version)
|
||||
err = removeRequire(deprecatedGoZeroMod, verbose)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return addRequire(mod, verbose)
|
||||
}
|
||||
|
||||
|
@ -50,22 +50,22 @@ func (c *colorConsole) Info(format string, a ...interface{}) {
|
||||
|
||||
func (c *colorConsole) Debug(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
println(aurora.Blue(msg))
|
||||
println(aurora.BrightCyan(msg))
|
||||
}
|
||||
|
||||
func (c *colorConsole) Success(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
println(aurora.Green(msg))
|
||||
println(aurora.BrightGreen(msg))
|
||||
}
|
||||
|
||||
func (c *colorConsole) Warning(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
println(aurora.Yellow(msg))
|
||||
println(aurora.BrightYellow(msg))
|
||||
}
|
||||
|
||||
func (c *colorConsole) Error(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
println(aurora.Red(msg))
|
||||
println(aurora.BrightRed(msg))
|
||||
}
|
||||
|
||||
func (c *colorConsole) Fatalln(format string, a ...interface{}) {
|
||||
@ -95,7 +95,7 @@ func (i *ideaConsole) Info(format string, a ...interface{}) {
|
||||
|
||||
func (i *ideaConsole) Debug(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
fmt.Println(aurora.Blue(msg))
|
||||
fmt.Println(aurora.BrightCyan(msg))
|
||||
}
|
||||
|
||||
func (i *ideaConsole) Success(format string, a ...interface{}) {
|
||||
|
Loading…
Reference in New Issue
Block a user