You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/command/version/version.go

42 lines
874 B

package version
import (
"fmt"
"github.com/hashicorp/consul/agent/consul"
"github.com/mitchellh/cli"
)
func New(ui cli.Ui, version string) *cmd {
return &cmd{UI: ui, version: version}
}
type cmd struct {
UI cli.Ui
version string
}
func (c *cmd) Run(_ []string) int {
c.UI.Output(fmt.Sprintf("Consul %s", c.version))
const rpcProtocol = consul.DefaultRPCProtocol
var supplement string
if rpcProtocol < consul.ProtocolVersionMax {
supplement = fmt.Sprintf(" (agent will automatically use protocol >%d when speaking to compatible agents)",
rpcProtocol)
}
c.UI.Output(fmt.Sprintf("Protocol %d spoken by default, understands %d to %d%s",
rpcProtocol, consul.ProtocolVersionMin, consul.ProtocolVersionMax, supplement))
return 0
}
func (c *cmd) Synopsis() string {
return "Prints the Consul version"
}
func (c *cmd) Help() string {
return ""
}