2019-06-25 11:42:17 +00:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
2019-07-12 15:29:41 +00:00
|
|
|
"fmt"
|
|
|
|
|
2019-06-25 11:42:17 +00:00
|
|
|
"gopkg.in/urfave/cli.v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
var versionCmd = &cli.Command{
|
2019-06-28 09:03:28 +00:00
|
|
|
Name: "version",
|
2019-06-25 11:42:17 +00:00
|
|
|
Usage: "Print version",
|
2019-07-12 15:29:41 +00:00
|
|
|
Action: func(cctx *cli.Context) error {
|
2019-10-03 18:12:30 +00:00
|
|
|
api, closer, err := GetAPI(cctx)
|
2019-07-12 15:29:41 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2019-10-03 18:12:30 +00:00
|
|
|
defer closer()
|
2019-07-12 15:29:41 +00:00
|
|
|
|
2019-07-18 23:16:23 +00:00
|
|
|
ctx := ReqContext(cctx)
|
2019-06-25 11:42:17 +00:00
|
|
|
// TODO: print more useful things
|
|
|
|
|
2019-07-12 15:29:41 +00:00
|
|
|
fmt.Println(api.Version(ctx))
|
|
|
|
cli.VersionPrinter(cctx)
|
2019-06-25 11:42:17 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|