diff --git a/cmd/mattermost/commands/version.go b/cmd/mattermost/commands/version.go index a502fc7d6c..e32ee362b7 100644 --- a/cmd/mattermost/commands/version.go +++ b/cmd/mattermost/commands/version.go @@ -16,10 +16,18 @@ var VersionCmd = &cobra.Command{ } func init() { + VersionCmd.Flags().Bool("skip-server-start", false, "Skip the server initialization and return the Mattermost version without the DB version.") + RootCmd.AddCommand(VersionCmd) } func versionCmdF(command *cobra.Command, args []string) error { + skipStart, _ := command.Flags().GetBool("skip-server-start") + if skipStart { + printVersionNoDB() + return nil + } + a, err := InitDBCommandContextCobra(command) if err != nil { return err @@ -31,10 +39,14 @@ func versionCmdF(command *cobra.Command, args []string) error { } func printVersion(a *app.App) { + printVersionNoDB() + CommandPrintln("DB Version: " + a.Srv().Store.GetCurrentSchemaVersion()) +} + +func printVersionNoDB() { CommandPrintln("Version: " + model.CurrentVersion) CommandPrintln("Build Number: " + model.BuildNumber) CommandPrintln("Build Date: " + model.BuildDate) CommandPrintln("Build Hash: " + model.BuildHash) CommandPrintln("Build Enterprise Ready: " + model.BuildEnterpriseReady) - CommandPrintln("DB Version: " + a.Srv().Store.GetCurrentSchemaVersion()) }