31 lines
455 B
Go
31 lines
455 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"gopkg.in/urfave/cli.v2"
|
|
)
|
|
|
|
var versionCmd = &cli.Command{
|
|
Name: "version",
|
|
Usage: "Print version",
|
|
Action: func(cctx *cli.Context) error {
|
|
api, closer, err := GetAPI(cctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer closer()
|
|
|
|
ctx := ReqContext(cctx)
|
|
// TODO: print more useful things
|
|
|
|
v, err := api.Version(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fmt.Println(v)
|
|
cli.VersionPrinter(cctx)
|
|
return nil
|
|
},
|
|
}
|