open-vault/command/version.go

30 lines
554 B
Go
Raw Normal View History

2015-03-04 07:03:24 +00:00
package command
import (
2015-11-09 18:52:55 +00:00
"github.com/hashicorp/vault/version"
2015-03-04 07:03:24 +00:00
"github.com/mitchellh/cli"
)
// VersionCommand is a Command implementation prints the version.
type VersionCommand struct {
2015-11-09 18:52:55 +00:00
VersionInfo *version.VersionInfo
Ui cli.Ui
2015-03-04 07:03:24 +00:00
}
func (c *VersionCommand) Help() string {
return ""
}
func (c *VersionCommand) Run(_ []string) int {
2016-11-28 00:32:57 +00:00
out := c.VersionInfo.FullVersionNumber(true)
if version.CgoEnabled {
out += " (cgo)"
}
c.Ui.Output(out)
2015-03-04 07:03:24 +00:00
return 0
}
func (c *VersionCommand) Synopsis() string {
return "Prints the Vault version"
}