mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
cmd/version: skip server start to get the current mattermost version (#15234)
This commit is contained in:
committed by
GitHub
parent
91a76b2df9
commit
4e43826c5c
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user