You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/tool/kratos/main.go

65 lines
1.1 KiB

package main
import (
"fmt"
"os"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "kratos"
app.Usage = "kratos工具集"
app.Version = Version
app.Commands = []cli.Command{
{
Name: "new",
Aliases: []string{"n"},
Usage: "创建新项目",
Action: runNew,
SkipFlagParsing: true,
},
{
Name: "build",
Aliases: []string{"b"},
Usage: "kratos build",
Action: buildAction,
},
{
Name: "run",
Aliases: []string{"r"},
Usage: "kratos run",
Action: runAction,
},
{
Name: "tool",
Aliases: []string{"t"},
Usage: "kratos tool",
Action: toolAction,
SkipFlagParsing: true,
},
{
Name: "version",
Aliases: []string{"v"},
Usage: "kratos version",
Action: func(c *cli.Context) error {
fmt.Println(getVersion())
return nil
},
},
{
Name: "self-upgrade",
Usage: "kratos self-upgrade",
Action: upgradeAction,
},
}
err := app.Run(os.Args)
if err != nil {
panic(err)
}
}
func runNew(ctx *cli.Context) error {
return installAndRun("genproject", ctx.Args())
}