feat: replaced color package to support Windows (#3207)

This commit is contained in:
ALMAS 2023-05-05 21:09:54 +08:00 committed by GitHub
parent 8ad0668612
commit 774e8d1d08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 55 additions and 85 deletions

View File

@ -8,7 +8,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/tools/goctl/util" "github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx" "github.com/zeromicro/go-zero/tools/goctl/util/pathx"
@ -73,6 +73,6 @@ func CreateApiTemplate(_ *cobra.Command, _ []string) error {
return err return err
} }
fmt.Println(aurora.Green("Done.")) fmt.Println(color.Green.Render("Done."))
return nil return nil
} }

View File

@ -11,7 +11,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
apiformat "github.com/zeromicro/go-zero/tools/goctl/api/format" apiformat "github.com/zeromicro/go-zero/tools/goctl/api/format"
@ -109,7 +109,7 @@ func DoGenProject(apiFile, dir, style string) error {
return err return err
} }
fmt.Println(aurora.Green("Done.")) fmt.Println(color.Green.Render("Done."))
return nil return nil
} }
@ -152,14 +152,14 @@ func sweep() error {
seconds, err := strconv.ParseInt(timestamp, 10, 64) seconds, err := strconv.ParseInt(timestamp, 10, 64)
if err != nil { if err != nil {
// print error and ignore // print error and ignore
fmt.Println(aurora.Red(fmt.Sprintf("sweep ignored file: %s", fpath))) fmt.Println(color.Red.Sprintf("sweep ignored file: %s", fpath))
return nil return nil
} }
tm := time.Unix(seconds, 0) tm := time.Unix(seconds, 0)
if tm.Before(keepTime) { if tm.Before(keepTime) {
if err := os.RemoveAll(fpath); err != nil { if err := os.RemoveAll(fpath); err != nil {
fmt.Println(aurora.Red(fmt.Sprintf("failed to remove file: %s", fpath))) fmt.Println(color.Red.Sprintf("failed to remove file: %s", fpath))
return err return err
} }
} }

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/tools/goctl/api/parser" "github.com/zeromicro/go-zero/tools/goctl/api/parser"
@ -45,6 +45,6 @@ func JavaCommand(_ *cobra.Command, _ []string) error {
logx.Must(genPacket(dir, packetName, api)) logx.Must(genPacket(dir, packetName, api))
logx.Must(genComponents(dir, packetName, api)) logx.Must(genComponents(dir, packetName, api))
fmt.Println(aurora.Green("Done.")) fmt.Println(color.Green.Render("Done."))
return nil return nil
} }

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/tools/goctl/api/parser" "github.com/zeromicro/go-zero/tools/goctl/api/parser"
@ -45,7 +45,7 @@ func TsCommand(_ *cobra.Command, _ []string) error {
api, err := parser.Parse(apiFile) api, err := parser.Parse(apiFile)
if err != nil { if err != nil {
fmt.Println(aurora.Red("Failed")) fmt.Println(color.Red.Render("Failed"))
return err return err
} }
@ -59,6 +59,6 @@ func TsCommand(_ *cobra.Command, _ []string) error {
logx.Must(genHandler(dir, webAPI, caller, api, unwrapAPI)) logx.Must(genHandler(dir, webAPI, caller, api, unwrapAPI))
logx.Must(genComponents(dir, api)) logx.Must(genComponents(dir, api))
fmt.Println(aurora.Green("Done.")) fmt.Println(color.Green.Render("Done."))
return nil return nil
} }

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/tools/goctl/api/parser" "github.com/zeromicro/go-zero/tools/goctl/api/parser"
) )
@ -27,7 +27,7 @@ func GoValidateApi(_ *cobra.Command, _ []string) error {
err = spec.Validate() err = spec.Validate()
if err == nil { if err == nil {
fmt.Println(aurora.Green("api format ok")) fmt.Println(color.Green.Render("api format ok"))
} }
return err return err
} }

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"text/template" "text/template"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/withfig/autocomplete-tools/integrations/cobra" "github.com/withfig/autocomplete-tools/integrations/cobra"
"github.com/zeromicro/go-zero/tools/goctl/api" "github.com/zeromicro/go-zero/tools/goctl/api"
@ -44,7 +44,7 @@ var (
func Execute() { func Execute() {
os.Args = supportGoStdFlag(os.Args) os.Args = supportGoStdFlag(os.Args)
if err := rootCmd.Execute(); err != nil { if err := rootCmd.Execute(); err != nil {
fmt.Println(aurora.Red(err.Error())) fmt.Println(color.Red.Render(err.Error()))
os.Exit(codeFailure) os.Exit(codeFailure)
} }
} }

View File

@ -2,53 +2,40 @@ package cmd
import ( import (
"fmt" "fmt"
"runtime"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/zeromicro/go-zero/tools/goctl/vars"
) )
var colorRender = []func(v any) string{ var colorRender = []func(v any) string{
func(v any) string { func(v any) string {
return aurora.BrightRed(v).String() return color.LightRed.Render(v)
}, },
func(v any) string { func(v any) string {
return aurora.BrightGreen(v).String() return color.LightGreen.Render(v)
}, },
func(v any) string { func(v any) string {
return aurora.BrightYellow(v).String() return color.LightYellow.Render(v)
}, },
func(v any) string { func(v any) string {
return aurora.BrightBlue(v).String() return color.LightBlue.Render(v)
}, },
func(v any) string { func(v any) string {
return aurora.BrightMagenta(v).String() return color.LightMagenta.Render(v)
}, },
func(v any) string { func(v any) string {
return aurora.BrightCyan(v).String() return color.LightCyan.Render(v)
}, },
} }
func blue(s string) string { func blue(s string) string {
if runtime.GOOS == vars.OsWindows { return color.LightBlue.Render(s)
return s
}
return aurora.BrightBlue(s).String()
} }
func green(s string) string { func green(s string) string {
if runtime.GOOS == vars.OsWindows { return color.LightGreen.Render(s)
return s
}
return aurora.BrightGreen(s).String()
} }
func rainbow(s string) string { func rainbow(s string) string {
if runtime.GOOS == vars.OsWindows {
return s
}
s0 := s[0] s0 := s[0]
return colorRender[int(s0)%(len(colorRender)-1)](s) return colorRender[int(s0)%(len(colorRender)-1)](s)
} }

View File

@ -9,7 +9,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx" "github.com/zeromicro/go-zero/tools/goctl/util/pathx"
) )
@ -34,7 +34,7 @@ func (f File) execute(goctl string) error {
} }
printCommand := strings.ReplaceAll(fmt.Sprintf("cd %s && %s", printDir, f.Cmd), "goctl", filepath.Base(goctl)) printCommand := strings.ReplaceAll(fmt.Sprintf("cd %s && %s", printDir, f.Cmd), "goctl", filepath.Base(goctl))
command := strings.ReplaceAll(fmt.Sprintf("cd %s && %s", dir, f.Cmd), "goctl", goctl) command := strings.ReplaceAll(fmt.Sprintf("cd %s && %s", dir, f.Cmd), "goctl", goctl)
fmt.Println(aurora.BrightGreen(printCommand)) fmt.Println(color.LightGreen.Render(printCommand))
cmd := exec.Command("sh", "-c", command) cmd := exec.Command("sh", "-c", command)
cmd.Env = os.Environ() cmd.Env = os.Environ()
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
@ -106,10 +106,10 @@ func MustRun(baseDir string) {
must(err) must(err)
goctlNew, err := exec.LookPath("goctl") goctlNew, err := exec.LookPath("goctl")
must(err) must(err)
fmt.Println(aurora.BrightBlue("========================goctl.old=======================")) fmt.Println(color.LightBlue.Render("========================goctl.old======================="))
must(oldFiles.execute(goctlOld)) must(oldFiles.execute(goctlOld))
fmt.Println() fmt.Println()
fmt.Println(aurora.BrightBlue("========================goctl.new=======================")) fmt.Println(color.LightBlue.Render("========================goctl.new======================="))
must(newFiles.execute(goctlNew)) must(newFiles.execute(goctlNew))
} }

View File

@ -9,7 +9,7 @@ import (
"strings" "strings"
"text/template" "text/template"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/tools/goctl/util" "github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/env" "github.com/zeromicro/go-zero/tools/goctl/util/env"
@ -42,7 +42,7 @@ type Docker struct {
func dockerCommand(_ *cobra.Command, _ []string) (err error) { func dockerCommand(_ *cobra.Command, _ []string) (err error) {
defer func() { defer func() {
if err == nil { if err == nil {
fmt.Println(aurora.Green("Done.")) fmt.Println(color.Green.Render("Done."))
} }
}() }()

View File

@ -7,8 +7,8 @@ require (
github.com/emicklei/proto v1.11.2 github.com/emicklei/proto v1.11.2
github.com/fatih/structtag v1.2.0 github.com/fatih/structtag v1.2.0
github.com/go-sql-driver/mysql v1.7.1 github.com/go-sql-driver/mysql v1.7.1
github.com/gookit/color v1.5.3
github.com/iancoleman/strcase v0.2.0 github.com/iancoleman/strcase v0.2.0
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/spf13/cobra v1.7.0 github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2 github.com/stretchr/testify v1.8.2
@ -56,6 +56,7 @@ require (
github.com/jackc/pgx/v5 v5.3.1 // indirect github.com/jackc/pgx/v5 v5.3.1 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-isatty v0.0.17 // indirect
@ -71,6 +72,7 @@ require (
github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect github.com/yuin/gopher-lua v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.8 // indirect go.etcd.io/etcd/api/v3 v3.5.8 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.8 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.8 // indirect

View File

@ -185,6 +185,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gookit/color v1.5.3 h1:twfIhZs4QLCtimkP7MOxlF3A0U/5cDPseRT9M/+2SCE=
github.com/gookit/color v1.5.3/go.mod h1:NUzwzeehUfl7GIb36pqId+UGmRfQcU/WiiyTTeNjHtE=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 h1:1JYBfzqrWPcCclBwxFCPAou9n+q86mfnu7NAeHfte7A= github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 h1:1JYBfzqrWPcCclBwxFCPAou9n+q86mfnu7NAeHfte7A=
@ -286,6 +288,8 @@ github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I= github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k= github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"text/template" "text/template"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/tools/goctl/util" "github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx" "github.com/zeromicro/go-zero/tools/goctl/util/pathx"
@ -111,7 +111,7 @@ func deploymentCommand(_ *cobra.Command, _ []string) error {
return err return err
} }
fmt.Println(aurora.Green("Done.")) fmt.Println(color.Green.Render("Done."))
return nil return nil
} }

View File

@ -11,15 +11,13 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"time" "time"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/tools/goctl/util/console" "github.com/zeromicro/go-zero/tools/goctl/util/console"
"github.com/zeromicro/go-zero/tools/goctl/util/ctx" "github.com/zeromicro/go-zero/tools/goctl/util/ctx"
"github.com/zeromicro/go-zero/tools/goctl/vars"
) )
const defaultMigrateVersion = "v1.3.0" const defaultMigrateVersion = "v1.3.0"
@ -246,10 +244,7 @@ It's recommended to use the replacement package, do you want to replace?
['Y' for yes, 'N' for no, 'A' for all, 'I' for ignore]: `, ['Y' for yes, 'N' for no, 'A' for all, 'I' for ignore]: `,
deprecated, replacement) deprecated, replacement)
if runtime.GOOS != vars.OsWindows { fmt.Print(color.Yellow.Render(msg))
msg = aurora.Yellow(msg).String()
}
fmt.Print(msg)
for { for {
var in string var in string

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/zeromicro/go-zero/core/errorx" "github.com/zeromicro/go-zero/core/errorx"
"github.com/zeromicro/go-zero/tools/goctl/api/apigen" "github.com/zeromicro/go-zero/tools/goctl/api/apigen"
@ -70,8 +70,8 @@ func genTemplates(_ *cobra.Command, _ []string) error {
return err return err
} }
fmt.Printf("Templates are generated in %s, %s\n", aurora.Green(abs), fmt.Printf("Templates are generated in %s, %s\n", color.Green.Render(abs),
aurora.Red("edit on your risk!")) color.Red.Render("edit on your risk!"))
return nil return nil
} }
@ -116,7 +116,7 @@ func cleanTemplates(_ *cobra.Command, _ []string) error {
return err return err
} }
fmt.Printf("%s\n", aurora.Green("templates are cleaned!")) fmt.Printf("%s\n", color.Green.Render("templates are cleaned!"))
return nil return nil
} }
@ -131,7 +131,7 @@ func updateTemplates(_ *cobra.Command, _ []string) (err error) {
defer func() { defer func() {
if err == nil { if err == nil {
fmt.Println(aurora.Green(fmt.Sprintf("%s template are update!", category)).String()) fmt.Println(color.Green.Sprintf("%s template are update!", category))
} }
}() }()
switch category { switch category {
@ -170,7 +170,7 @@ func revertTemplates(_ *cobra.Command, _ []string) (err error) {
defer func() { defer func() {
if err == nil { if err == nil {
fmt.Println(aurora.Green(fmt.Sprintf("%s template are reverted!", filename)).String()) fmt.Println(color.Green.Sprintf("%s template are reverted!", filename))
} }
}() }()
switch category { switch category {

View File

@ -3,10 +3,8 @@ package console
import ( import (
"fmt" "fmt"
"os" "os"
"runtime"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/zeromicro/go-zero/tools/goctl/vars"
) )
type ( type (
@ -63,32 +61,28 @@ func (c *colorConsole) Debug(format string, a ...any) {
if !c.enable { if !c.enable {
return return
} }
msg := fmt.Sprintf(format, a...) println(color.LightCyan.Sprintf(format, a...))
println(aurora.BrightCyan(msg))
} }
func (c *colorConsole) Success(format string, a ...any) { func (c *colorConsole) Success(format string, a ...any) {
if !c.enable { if !c.enable {
return return
} }
msg := fmt.Sprintf(format, a...) println(color.LightGreen.Sprintf(format, a...))
println(aurora.BrightGreen(msg))
} }
func (c *colorConsole) Warning(format string, a ...any) { func (c *colorConsole) Warning(format string, a ...any) {
if !c.enable { if !c.enable {
return return
} }
msg := fmt.Sprintf(format, a...) println(color.LightYellow.Sprintf(format, a...))
println(aurora.BrightYellow(msg))
} }
func (c *colorConsole) Error(format string, a ...any) { func (c *colorConsole) Error(format string, a ...any) {
if !c.enable { if !c.enable {
return return
} }
msg := fmt.Sprintf(format, a...) println(color.LightRed.Sprintf(format, a...))
println(aurora.BrightRed(msg))
} }
func (c *colorConsole) Fatalln(format string, a ...any) { func (c *colorConsole) Fatalln(format string, a ...any) {
@ -126,8 +120,7 @@ func (i *ideaConsole) Info(format string, a ...any) {
} }
func (i *ideaConsole) Debug(format string, a ...any) { func (i *ideaConsole) Debug(format string, a ...any) {
msg := fmt.Sprintf(format, a...) fmt.Println(color.LightCyan.Sprintf(format, a...))
fmt.Println(aurora.BrightCyan(msg))
} }
func (i *ideaConsole) Success(format string, a ...any) { func (i *ideaConsole) Success(format string, a ...any) {
@ -161,17 +154,6 @@ func (i *ideaConsole) Must(err error) {
} }
func println(msg any) { func println(msg any) {
value, ok := msg.(aurora.Value)
if !ok {
fmt.Println(msg)
}
goos := runtime.GOOS
if goos == vars.OsWindows {
fmt.Println(value.Value())
return
}
fmt.Println(msg) fmt.Println(msg)
} }

View File

@ -12,7 +12,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/logrusorgru/aurora" "github.com/gookit/color"
"github.com/zeromicro/go-zero/tools/goctl/internal/version" "github.com/zeromicro/go-zero/tools/goctl/internal/version"
) )
@ -58,7 +58,7 @@ func RemoveOrQuit(filename string) error {
} }
fmt.Printf("%s exists, overwrite it?\nEnter to overwrite or Ctrl-C to cancel...", fmt.Printf("%s exists, overwrite it?\nEnter to overwrite or Ctrl-C to cancel...",
aurora.BgRed(aurora.Bold(filename))) color.New(color.BgRed, color.Bold).Render(filename))
bufio.NewReader(os.Stdin).ReadBytes('\n') bufio.NewReader(os.Stdin).ReadBytes('\n')
return os.Remove(filename) return os.Remove(filename)