Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
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.
 
 
 
 
 
 

45 lines
976 B

package version
import (
"fmt"
"github.com/hashicorp/consul/agent/config"
"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))
rpcProtocol, err := config.DefaultRPCProtocol()
if err != nil {
c.UI.Error(err.Error())
return 2
}
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 ""
}