github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/cmd/mattermost/commands/version.go (about) 1 // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package commands 5 6 import ( 7 "github.com/mattermost/mattermost-server/app" 8 "github.com/mattermost/mattermost-server/model" 9 "github.com/mattermost/mattermost-server/store" 10 "github.com/mattermost/mattermost-server/store/sqlstore" 11 "github.com/spf13/cobra" 12 ) 13 14 var VersionCmd = &cobra.Command{ 15 Use: "version", 16 Short: "Display version information", 17 RunE: versionCmdF, 18 } 19 20 func init() { 21 RootCmd.AddCommand(VersionCmd) 22 } 23 24 func versionCmdF(command *cobra.Command, args []string) error { 25 a, err := InitDBCommandContextCobra(command) 26 if err != nil { 27 return err 28 } 29 30 printVersion(a) 31 32 return nil 33 } 34 35 func printVersion(a *app.App) { 36 CommandPrintln("Version: " + model.CurrentVersion) 37 CommandPrintln("Build Number: " + model.BuildNumber) 38 CommandPrintln("Build Date: " + model.BuildDate) 39 CommandPrintln("Build Hash: " + model.BuildHash) 40 CommandPrintln("Build Enterprise Ready: " + model.BuildEnterpriseReady) 41 if supplier, ok := a.Srv.Store.(*store.LayeredStore).DatabaseLayer.(*sqlstore.SqlSupplier); ok { 42 CommandPrintln("DB Version: " + supplier.GetCurrentSchemaVersion()) 43 } 44 }