Version fixes

This commit is contained in:
Łukasz Magiera 2019-12-11 01:22:58 +01:00
parent ce6912047d
commit e6dd471103
2 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,7 @@
package build
// Version is the local build version, set by build system
const Version = "0.11.0"
const Version = "0.1.0"
// APIVersion is a hex semver version of the rpc api exposed
//
@ -12,15 +12,19 @@ const Version = "0.11.0"
// R R H
// |\vv/|
// vv vv
const APIVersion = 0x000b01
const APIVersion = 0x000100
const (
MajorMask = 0xff0000
MinorMask = 0xffff00
PatchMask = 0xffffff
)
MajorOnlyMask = 0xff0000
MinorOnlyMask = 0x00ff00
PatchOnlyMask = 0x0000ff
c)
// VersionInts returns (major, minor, patch) versions
func VersionInts(version uint32) (uint32, uint32, uint32) {
return (version & MajorMask) >> 16, (version & MinorMask) >> 8, version & PatchMask
return (version & MajorOnlyMask) >> 16, (version & MinorOnlyMask) >> 8, version & PatchOnlyMask
}

View File

@ -19,7 +19,11 @@ var versionCmd = &cli.Command{
ctx := ReqContext(cctx)
// TODO: print more useful things
fmt.Println(api.Version(ctx))
v, err := api.Version(ctx)
if err != nil {
return err
}
fmt.Println(v)
cli.VersionPrinter(cctx)
return nil
},