2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2015-06-01 13:25:51 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
2017-08-16 22:42:15 +00:00
|
|
|
"github.com/hashicorp/nomad/version"
|
2015-06-01 13:25:51 +00:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
// VersionCommand is a Command implementation prints the version.
|
|
|
|
type VersionCommand struct {
|
2017-08-16 22:42:15 +00:00
|
|
|
Version *version.VersionInfo
|
2017-07-17 18:04:07 +00:00
|
|
|
Ui cli.Ui
|
2015-06-01 13:25:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *VersionCommand) Help() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2018-04-18 16:02:11 +00:00
|
|
|
func (c *VersionCommand) Name() string { return "version" }
|
|
|
|
|
2015-06-01 13:25:51 +00:00
|
|
|
func (c *VersionCommand) Run(_ []string) int {
|
2017-08-16 22:42:15 +00:00
|
|
|
c.Ui.Output(c.Version.FullVersionNumber(true))
|
2015-06-01 13:25:51 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *VersionCommand) Synopsis() string {
|
|
|
|
return "Prints the Nomad version"
|
|
|
|
}
|