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.
25 lines
540 B
25 lines
540 B
package main
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
const (
|
|
_getSwaggerGen = "go get -u github.com/bilibili/kratos/tool/protobuf/protoc-gen-bswagger"
|
|
_swaggerProtoc = "protoc --proto_path=%s --proto_path=%s --proto_path=%s --bswagger_out=explicit_http=true:."
|
|
)
|
|
|
|
func installSwaggerGen() error {
|
|
if _, err := exec.LookPath("protoc-gen-bswagger"); err != nil {
|
|
if err := goget(_getSwaggerGen); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func genSwagger(ctx *cli.Context) error {
|
|
return generate(ctx, _swaggerProtoc)
|
|
}
|
|
|