lotus/cli/version.go

33 lines
493 B
Go
Raw Permalink Normal View History

package cli
import (
2019-07-12 15:29:41 +00:00
"fmt"
"github.com/urfave/cli/v2"
)
2020-08-04 18:57:40 +00:00
var VersionCmd = &cli.Command{
Name: "version",
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)
// TODO: print more useful things
2019-12-11 00:22:58 +00:00
v, err := api.Version(ctx)
if err != nil {
return err
}
2020-06-01 18:43:51 +00:00
fmt.Println("Daemon: ", v)
fmt.Print("Local: ")
2019-07-12 15:29:41 +00:00
cli.VersionPrinter(cctx)
return nil
},
}