Skip to content

Commit

Permalink
update tool version
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Wu committed Dec 14, 2021
1 parent 0b6c0d7 commit 643c6f3
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 153 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/fatih/color v1.13.0
github.com/gin-gonic/gin v1.7.4
github.com/gin-gonic/gin v1.7.7
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-resty/resty/v2 v2.6.0
github.com/go-resty/resty/v2 v2.7.0
github.com/go-sql-driver/mysql v1.6.0
github.com/mailru/easyjson v0.7.7 // indirect
github.com/prometheus/client_golang v1.11.0
github.com/qit-team/snow-core v0.1.27
github.com/qit-team/snow-core v0.1.28
github.com/qit-team/work v0.3.11
github.com/robfig/cron v1.2.0
github.com/swaggo/gin-swagger v1.3.1
github.com/swaggo/swag v1.7.2
github.com/urfave/cli v1.22.5
github.com/swaggo/gin-swagger v1.3.3
github.com/swaggo/swag v1.7.6
github.com/urfave/cli/v2 v2.3.0
gopkg.in/go-playground/validator.v9 v9.31.0
xorm.io/core v0.7.3
xorm.io/xorm v1.2.4
)
xorm.io/xorm v1.2.5
)
249 changes: 137 additions & 112 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tool/snow/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"os"
)

Expand Down
20 changes: 10 additions & 10 deletions tool/snow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"os"
)

Expand All @@ -11,19 +11,19 @@ func main() {
app.Name = "snow"
app.Usage = "snow工具集"
app.Version = Version
app.Commands = []cli.Command{
app.Commands = cli.Commands{
{
Name: "new",
Aliases: []string{"n"},
Usage: "create new project",
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "path, p",
Value: "",
Usage: "directory for create project, default: current position",
Destination: &p.Path,
},
cli.StringFlag{
&cli.StringFlag{
Name: "module, m",
Usage: "project module name, for go mod init",
Destination: &p.ModuleName,
Expand All @@ -36,31 +36,31 @@ func main() {
Aliases: []string{"m"},
Usage: "create new model",
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "path, p",
Value: "",
Usage: "project directory, default: current position",
Destination: &m.Path,
},
cli.StringFlag{
&cli.StringFlag{
Name: "table, t",
Value: "",
Usage: "table name for new model, default: model name",
Destination: &m.Table,
},
cli.StringFlag{
&cli.StringFlag{
Name: "dsn, d",
Value: "",
Usage: "database dsn config, default: GetEnv('SNOW_DSN') or 'root:123456@tcp(localhost:3306)/test'",
Destination: &m.DSN,
},
cli.StringFlag{
&cli.StringFlag{
Name: "db, b",
Value: "",
Usage: "database name, will replace dsn's database",
Destination: &m.DB,
},
cli.StringFlag{
&cli.StringFlag{
Name: "driver, r",
Value: "",
Usage: "driver type, default: mysql",
Expand Down Expand Up @@ -89,7 +89,7 @@ func main() {
Usage: "generate doc",

Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "path, p",
Value: "",
Usage: "project directory, default: current position",
Expand Down
6 changes: 3 additions & 3 deletions tool/snow/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

_ "github.com/go-sql-driver/mysql"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"xorm.io/core"
"xorm.io/xorm"
"xorm.io/xorm/schemas"
Expand Down Expand Up @@ -85,11 +85,11 @@ func init() {

//new model
func runModel(ctx *cli.Context) (err error) {
if len(ctx.Args()) == 0 {
if ctx.Args().Len() == 0 {
return errors.New("required model name")
}

m.Name = ctx.Args()[0]
m.Name = ctx.Args().First()
if m.Name == "" {
return errors.New("model name is empty")
}
Expand Down
6 changes: 3 additions & 3 deletions tool/snow/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package main
import (
"errors"
"fmt"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"os"
"path"
)

func runNew(ctx *cli.Context) error {
if len(ctx.Args()) == 0 {
if ctx.Args().Len() == 0 {
return errors.New("required project name")
}
p.Name = ctx.Args()[0]
p.Name = ctx.Args().First()

if p.ModuleName == "" {
p.ModuleName = p.Name
Expand Down
31 changes: 20 additions & 11 deletions tool/snow/template_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ sh build/shell/build.sh
go 1.12
require (
github.com/BurntSushi/toml v0.3.1
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
github.com/gin-gonic/gin v1.4.0
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-sql-driver/mysql v1.4.1
github.com/leodido/go-urn v1.2.0 // indirect
github.com/qit-team/snow-core v0.1.10
github.com/qit-team/work v0.3.5
github.com/BurntSushi/toml v0.4.1
github.com/SkyAPM/go2sky v0.6.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/fatih/color v1.13.0
github.com/gin-gonic/gin v1.7.7
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-resty/resty/v2 v2.7.0
github.com/go-sql-driver/mysql v1.6.0
github.com/mailru/easyjson v0.7.7 // indirect
github.com/prometheus/client_golang v1.11.0
github.com/qit-team/snow-core v0.1.28
github.com/qit-team/work v0.3.11
github.com/robfig/cron v1.2.0
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.2
gopkg.in/go-playground/validator.v9 v9.29.1
github.com/swaggo/gin-swagger v1.3.3
github.com/swaggo/swag v1.7.6
github.com/urfave/cli/v2 v2.3.0
gopkg.in/go-playground/validator.v9 v9.31.0
xorm.io/core v0.7.3
xorm.io/xorm v1.2.5
)
`

Expand Down
6 changes: 3 additions & 3 deletions tool/snow/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/fatih/color"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"go/build"
"os"
"os/exec"
Expand Down Expand Up @@ -50,7 +50,7 @@ func toolAction(c *cli.Context) (err error) {
pwd, _ := os.Getwd()
var args []string
if c.NArg() > 1 {
args = []string(c.Args())[1:]
args = c.Args().Slice()[1:]
}
runTool(t.Name, pwd, t.toolPath(), args)
return
Expand Down Expand Up @@ -211,7 +211,7 @@ func gopath() (gp string) {
}

func installSwag() error {
cmdName, cmdPath, command := "swag install", gopath(), "go get -u github.com/swaggo/swag/cmd/swag"
cmdName, cmdPath, command := "swag install", gopath(), "go install github.com/swaggo/swag/cmd/swag@latest"

cmds := strings.Split(command, " ")
err := runTool(cmdName, cmdPath, cmds[0], cmds[1:])
Expand Down
4 changes: 2 additions & 2 deletions tool/snow/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

var (
// Version is version
Version = "1.2.1"
Version = "1.2.4"
// BuildTime is BuildTime
BuildTime = "2020/06/16 15:30:00"
BuildTime = "2021/12/14 14:30:00"
)

// VersionOptions include version
Expand Down

0 comments on commit 643c6f3

Please sign in to comment.