mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 13:55:55 +00:00
commands: cleanup help and synopsis.
* move Help and Synopsis to bottom * make help and synopsis constants * make sure help output is formatted
This commit is contained in:
parent
d54a5ef8d8
commit
56b24d3d4f
@ -54,7 +54,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
revision string
|
revision string
|
||||||
version string
|
version string
|
||||||
versionPrerelease string
|
versionPrerelease string
|
||||||
@ -70,15 +70,7 @@ type cmd struct {
|
|||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
config.AddFlags(c.flags, &c.flagArgs)
|
config.AddFlags(c.flags, &c.flagArgs)
|
||||||
c.usage = flags.Usage(usage, c.flags, nil, nil)
|
c.help = flags.Usage(help, c.flags, nil, nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Runs a Consul agent"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -499,7 +491,18 @@ func (c *cmd) handleReload(agent *agent.Agent, cfg *config.RuntimeConfig) (*conf
|
|||||||
return cfg, errs
|
return cfg, errs
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul agent [options]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Runs a Consul agent"
|
||||||
|
const help = `
|
||||||
|
Usage: consul agent [options]
|
||||||
|
|
||||||
Starts the Consul agent and runs until an interrupt is received. The
|
Starts the Consul agent and runs until an interrupt is received. The
|
||||||
agent represents a single node in a cluster.`
|
agent represents a single node in a cluster.
|
||||||
|
`
|
||||||
|
@ -16,11 +16,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Interact with the catalog"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
s := `Usage: consul catalog <subcommand> [options] [args]
|
return flags.Usage(help, nil, nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Interact with the catalog"
|
||||||
|
const help = `
|
||||||
|
Usage: consul catalog <subcommand> [options] [args]
|
||||||
|
|
||||||
This command has subcommands for interacting with Consul's catalog. The
|
This command has subcommands for interacting with Consul's catalog. The
|
||||||
catalog should not be confused with the agent, although the APIs and
|
catalog should not be confused with the agent, although the APIs and
|
||||||
@ -41,6 +46,5 @@ func (c *cmd) Help() string {
|
|||||||
|
|
||||||
$ consul catalog services
|
$ consul catalog services
|
||||||
|
|
||||||
For more examples, ask for subcommand help or view the documentation.`
|
For more examples, ask for subcommand help or view the documentation.
|
||||||
return flags.Usage(s, nil, nil, nil)
|
`
|
||||||
}
|
|
||||||
|
@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func TestCatalogCommand_noTabs(t *testing.T) {
|
func TestCatalogCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New().Help(), '\t') {
|
if strings.ContainsRune(New().Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -26,7 +26,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -59,14 +59,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Lists all known datacenters"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul catalog datacenters [options]
|
const synopsis = "Lists all known datacenters"
|
||||||
|
const help = `
|
||||||
|
Usage: consul catalog datacenters [options]
|
||||||
|
|
||||||
Retrieves the list of all known datacenters. This datacenters are sorted in
|
Retrieves the list of all known datacenters. This datacenters are sorted in
|
||||||
ascending order based on the estimated median round trip time from the servers
|
ascending order based on the estimated median round trip time from the servers
|
||||||
@ -76,4 +78,5 @@ const usage = `Usage: consul catalog datacenters [options]
|
|||||||
|
|
||||||
$ consul catalog datacenters
|
$ consul catalog datacenters
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestCatalogListDatacentersCommand_noTabs(t *testing.T) {
|
func TestCatalogListDatacentersCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
detailed bool
|
detailed bool
|
||||||
@ -48,8 +48,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -121,14 +120,6 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Lists all nodes in the given datacenter"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
|
||||||
|
|
||||||
// printNodes accepts a list of nodes and prints information in a tabular
|
// printNodes accepts a list of nodes and prints information in a tabular
|
||||||
// format about the nodes.
|
// format about the nodes.
|
||||||
func printNodes(nodes []*api.Node, detailed bool) (string, error) {
|
func printNodes(nodes []*api.Node, detailed bool) (string, error) {
|
||||||
@ -191,7 +182,17 @@ func mapToKV(m map[string]string, joiner string) string {
|
|||||||
return strings.Join(r, joiner)
|
return strings.Join(r, joiner)
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul catalog nodes [options]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Lists all nodes in the given datacenter"
|
||||||
|
const help = `
|
||||||
|
Usage: consul catalog nodes [options]
|
||||||
|
|
||||||
Retrieves the list nodes registered in a given datacenter. By default, the
|
Retrieves the list nodes registered in a given datacenter. By default, the
|
||||||
datacenter of the local agent is queried.
|
datacenter of the local agent is queried.
|
||||||
@ -217,4 +218,5 @@ const usage = `Usage: consul catalog nodes [options]
|
|||||||
|
|
||||||
$ consul catalog nodes -near=node-web
|
$ consul catalog nodes -near=node-web
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestCatalogListNodesCommand_noTabs(t *testing.T) {
|
func TestCatalogListNodesCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
node string
|
node string
|
||||||
@ -46,7 +46,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -126,14 +126,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Lists all registered services in a datacenter"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul catalog services [options]
|
const synopsis = "Lists all registered services in a datacenter"
|
||||||
|
const help = `
|
||||||
|
Usage: consul catalog services [options]
|
||||||
|
|
||||||
Retrieves the list services registered in a given datacenter. By default, the
|
Retrieves the list services registered in a given datacenter. By default, the
|
||||||
datacenter of the local agent is queried.
|
datacenter of the local agent is queried.
|
||||||
@ -154,4 +156,5 @@ const usage = `Usage: consul catalog services [options]
|
|||||||
|
|
||||||
$ consul catalog services -node-meta="foo=bar"
|
$ consul catalog services -node-meta="foo=bar"
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func TestCatalogListServicesCommand_noTabs(t *testing.T) {
|
func TestCatalogListServicesCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ type cmd struct {
|
|||||||
node string
|
node string
|
||||||
service string
|
service string
|
||||||
tag string
|
tag string
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -40,7 +40,7 @@ func (c *cmd) init() {
|
|||||||
|
|
||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -129,15 +129,18 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Fire a new event"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul event [options] [payload]
|
const synopsis = "Fire a new event"
|
||||||
|
const help = `
|
||||||
|
Usage: consul event [options] [payload]
|
||||||
|
|
||||||
Dispatches a custom user event across a datacenter. An event must provide
|
Dispatches a custom user event across a datacenter. An event must provide
|
||||||
a name, but a payload is optional. Events support filtering using
|
a name, but a payload is optional. Events support filtering using
|
||||||
regular expressions on node name, service, and tag definitions.`
|
regular expressions on node name, service, and tag definitions.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestEventCommand_noTabs(t *testing.T) {
|
func TestEventCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
shutdownCh <-chan struct{}
|
shutdownCh <-chan struct{}
|
||||||
conf rExecConf
|
conf rExecConf
|
||||||
@ -60,7 +60,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -183,13 +183,23 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Executes a command on Consul nodes"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const synopsis = "Executes a command on Consul nodes"
|
||||||
|
const help = `
|
||||||
|
Usage: consul exec [options] [-|command...]
|
||||||
|
|
||||||
|
Evaluates a command on remote Consul nodes. The nodes responding can
|
||||||
|
be filtered using regular expressions on node name, service, and tag
|
||||||
|
definitions. If a command is '-', stdin will be read until EOF
|
||||||
|
and used as a script input.
|
||||||
|
`
|
||||||
|
|
||||||
// waitForJob is used to poll for results and wait until the job is terminated
|
// waitForJob is used to poll for results and wait until the job is terminated
|
||||||
func (c *cmd) waitForJob() int {
|
func (c *cmd) waitForJob() int {
|
||||||
// Although the session destroy is already deferred, we do it again here,
|
// Although the session destroy is already deferred, we do it again here,
|
||||||
@ -685,10 +695,3 @@ func (u *TargetedUI) prefixLines(arrow bool, message string) string {
|
|||||||
|
|
||||||
return strings.TrimRightFunc(result.String(), unicode.IsSpace)
|
return strings.TrimRightFunc(result.String(), unicode.IsSpace)
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul exec [options] [-|command...]
|
|
||||||
|
|
||||||
Evaluates a command on remote Consul nodes. The nodes responding can
|
|
||||||
be filtered using regular expressions on node name, service, and tag
|
|
||||||
definitions. If a command is '-', stdin will be read until EOF
|
|
||||||
and used as a script input. `
|
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func TestExecCommand_noTabs(t *testing.T) {
|
func TestExecCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil, nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil, nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -26,7 +26,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -58,18 +58,21 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Forces a member of the cluster to enter the \"left\" state"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul force-leave [options] name
|
const synopsis = "Forces a member of the cluster to enter the \"left\" state"
|
||||||
|
const help = `
|
||||||
|
Usage: consul force-leave [options] name
|
||||||
|
|
||||||
Forces a member of a Consul cluster to enter the "left" state. Note
|
Forces a member of a Consul cluster to enter the "left" state. Note
|
||||||
that if the member is still actually alive, it will eventually rejoin
|
that if the member is still actually alive, it will eventually rejoin
|
||||||
the cluster. This command is most useful for cleaning out "failed" nodes
|
the cluster. This command is most useful for cleaning out "failed" nodes
|
||||||
that are never coming back. If you do not force leave a failed node,
|
that are never coming back. If you do not force leave a failed node,
|
||||||
Consul will attempt to reconnect to those failed nodes for some period of
|
Consul will attempt to reconnect to those failed nodes for some period of
|
||||||
time before eventually reaping them.`
|
time before eventually reaping them.
|
||||||
|
`
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func TestForceLeaveCommand_noTabs(t *testing.T) {
|
func TestForceLeaveCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -84,13 +84,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Provides debugging information for operators."
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul info [options]
|
const synopsis = "Provides debugging information for operators."
|
||||||
|
const help = `
|
||||||
|
Usage: consul info [options]
|
||||||
|
|
||||||
Provides debugging information for operators`
|
Provides debugging information for operators.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestInfoCommand_noTabs(t *testing.T) {
|
func TestInfoCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
wan bool
|
wan bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ func (c *cmd) init() {
|
|||||||
|
|
||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -71,14 +71,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Tell Consul agent to join cluster"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul join [options] address ...
|
const synopsis = "Tell Consul agent to join cluster"
|
||||||
|
const help = `
|
||||||
|
Usage: consul join [options] address ...
|
||||||
|
|
||||||
Tells a running Consul agent (with "consul agent") to join the cluster
|
Tells a running Consul agent (with "consul agent") to join the cluster
|
||||||
by specifying at least one existing member.`
|
by specifying at least one existing member.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestJoinCommand_noTabs(t *testing.T) {
|
func TestJoinCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ func New(ui cli.Ui) *cmd {
|
|||||||
type cmd struct {
|
type cmd struct {
|
||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
c.usage = flags.Usage(usage, c.flags, nil, nil)
|
c.help = flags.Usage(help, c.flags, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -48,15 +48,18 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Generates a new encryption key"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul keygen
|
const synopsis = "Generates a new encryption key"
|
||||||
|
const help = `
|
||||||
|
Usage: consul keygen
|
||||||
|
|
||||||
Generates a new encryption key that can be used to configure the
|
Generates a new encryption key that can be used to configure the
|
||||||
agent to encrypt traffic. The output of this command is already
|
agent to encrypt traffic. The output of this command is already
|
||||||
in the proper format that the agent expects.`
|
in the proper format that the agent expects.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestKeygenCommand_noTabs(t *testing.T) {
|
func TestKeygenCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
installKey string
|
installKey string
|
||||||
@ -52,7 +52,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -162,14 +162,16 @@ func (c *cmd) handleList(responses []*consulapi.KeyringResponse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Manages gossip layer encryption keys"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul keyring [options]
|
const synopsis = "Manages gossip layer encryption keys"
|
||||||
|
const help = `
|
||||||
|
Usage: consul keyring [options]
|
||||||
|
|
||||||
Manages encryption keys used for gossip messages. Gossip encryption is
|
Manages encryption keys used for gossip messages. Gossip encryption is
|
||||||
optional. When enabled, this command may be used to examine active encryption
|
optional. When enabled, this command may be used to examine active encryption
|
||||||
@ -182,4 +184,5 @@ const usage = `Usage: consul keyring [options]
|
|||||||
|
|
||||||
All variations of the keyring command return 0 if all nodes reply and there
|
All variations of the keyring command return 0 if all nodes reply and there
|
||||||
are no errors. If any node fails to reply or reports failure, the exit code
|
are no errors. If any node fails to reply or reports failure, the exit code
|
||||||
will be 1.`
|
will be 1.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestKeyringCommand_noTabs(t *testing.T) {
|
func TestKeyringCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
cas bool
|
cas bool
|
||||||
modifyIndex uint64
|
modifyIndex uint64
|
||||||
recurse bool
|
recurse bool
|
||||||
@ -39,7 +39,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -138,14 +138,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Removes data from the KV store"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul kv delete [options] KEY_OR_PREFIX
|
const synopsis = "Removes data from the KV store"
|
||||||
|
const help = `
|
||||||
|
Usage: consul kv delete [options] KEY_OR_PREFIX
|
||||||
|
|
||||||
Removes the value from Consul's key-value store at the given path. If no
|
Removes the value from Consul's key-value store at the given path. If no
|
||||||
key exists at the path, no action is taken.
|
key exists at the path, no action is taken.
|
||||||
@ -159,4 +161,5 @@ const usage = `Usage: consul kv delete [options] KEY_OR_PREFIX
|
|||||||
$ consul kv delete -recurse foo
|
$ consul kv delete -recurse foo
|
||||||
|
|
||||||
This will delete the keys named "foo", "food", and "foo/bar/zip" if they
|
This will delete the keys named "foo", "food", and "foo/bar/zip" if they
|
||||||
existed. `
|
existed.
|
||||||
|
`
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func TestKVDeleteCommand_noTabs(t *testing.T) {
|
func TestKVDeleteCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -29,7 +29,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -89,14 +89,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Exports a tree from the KV store as JSON"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul kv export [KEY_OR_PREFIX]
|
const synopsis = "Exports a tree from the KV store as JSON"
|
||||||
|
const help = `
|
||||||
|
Usage: consul kv export [KEY_OR_PREFIX]
|
||||||
|
|
||||||
Retrieves key-value pairs for the given prefix from Consul's key-value store,
|
Retrieves key-value pairs for the given prefix from Consul's key-value store,
|
||||||
and writes a JSON representation to stdout. This can be used with the command
|
and writes a JSON representation to stdout. This can be used with the command
|
||||||
@ -104,4 +106,5 @@ const usage = `Usage: consul kv export [KEY_OR_PREFIX]
|
|||||||
|
|
||||||
$ consul kv export vault
|
$ consul kv export vault
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func TestKVExportCommand_noTabs(t *testing.T) {
|
func TestKVExportCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
base64encode bool
|
base64encode bool
|
||||||
detailed bool
|
detailed bool
|
||||||
keys bool
|
keys bool
|
||||||
@ -54,7 +54,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -175,11 +175,11 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Retrieves or lists data from the KV store"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
func prettyKVPair(w io.Writer, pair *api.KVPair, base64EncodeValue bool) error {
|
func prettyKVPair(w io.Writer, pair *api.KVPair, base64EncodeValue bool) error {
|
||||||
@ -202,7 +202,9 @@ func prettyKVPair(w io.Writer, pair *api.KVPair, base64EncodeValue bool) error {
|
|||||||
return tw.Flush()
|
return tw.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul kv get [options] [KEY_OR_PREFIX]
|
const synopsis = "Retrieves or lists data from the KV store"
|
||||||
|
const help = `
|
||||||
|
Usage: consul kv get [options] [KEY_OR_PREFIX]
|
||||||
|
|
||||||
Retrieves the value from Consul's key-value store at the given key name. If no
|
Retrieves the value from Consul's key-value store at the given key name. If no
|
||||||
key exists with that name, an error is returned. If a key exists with that
|
key exists with that name, an error is returned. If a key exists with that
|
||||||
@ -230,4 +232,5 @@ const usage = `Usage: consul kv get [options] [KEY_OR_PREFIX]
|
|||||||
|
|
||||||
$ consul kv get -keys foo
|
$ consul kv get -keys foo
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation. `
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func TestKVGetCommand_noTabs(t *testing.T) {
|
func TestKVGetCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// testStdin is the input for testing.
|
// testStdin is the input for testing.
|
||||||
testStdin io.Reader
|
testStdin io.Reader
|
||||||
@ -38,7 +38,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -91,14 +91,6 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Imports a tree stored as JSON to the KV store"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) dataFromArgs(args []string) (string, error) {
|
func (c *cmd) dataFromArgs(args []string) (string, error) {
|
||||||
var stdin io.Reader = os.Stdin
|
var stdin io.Reader = os.Stdin
|
||||||
if c.testStdin != nil {
|
if c.testStdin != nil {
|
||||||
@ -140,7 +132,17 @@ func (c *cmd) dataFromArgs(args []string) (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul kv import [DATA]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Imports a tree stored as JSON to the KV store"
|
||||||
|
const help = `
|
||||||
|
Usage: consul kv import [DATA]
|
||||||
|
|
||||||
Imports key-value pairs to the key-value store from the JSON representation
|
Imports key-value pairs to the key-value store from the JSON representation
|
||||||
generated by the "consul kv export" command.
|
generated by the "consul kv export" command.
|
||||||
@ -157,4 +159,5 @@ const usage = `Usage: consul kv import [DATA]
|
|||||||
Alternatively the data may be provided as the final parameter to the command,
|
Alternatively the data may be provided as the final parameter to the command,
|
||||||
though care must be taken with regards to shell escaping.
|
though care must be taken with regards to shell escaping.
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestKVImportCommand_noTabs(t *testing.T) {
|
func TestKVImportCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Interact with the key-value store"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
s := `Usage: consul kv <subcommand> [options] [args]
|
return flags.Usage(help, nil, nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Interact with the key-value store"
|
||||||
|
const help = `
|
||||||
|
Usage: consul kv <subcommand> [options] [args]
|
||||||
|
|
||||||
This command has subcommands for interacting with Consul's key-value
|
This command has subcommands for interacting with Consul's key-value
|
||||||
store. Here are some simple examples, and more detailed examples are
|
store. Here are some simple examples, and more detailed examples are
|
||||||
@ -42,6 +47,5 @@ func (c *cmd) Help() string {
|
|||||||
|
|
||||||
$ consul kv delete redis/config/connections
|
$ consul kv delete redis/config/connections
|
||||||
|
|
||||||
For more examples, ask for subcommand help or view the documentation.`
|
For more examples, ask for subcommand help or view the documentation.
|
||||||
return flags.Usage(s, nil, nil, nil)
|
`
|
||||||
}
|
|
||||||
|
@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func TestKVCommand_noTabs(t *testing.T) {
|
func TestKVCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New().Help(), '\t') {
|
if strings.ContainsRune(New().Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
cas bool
|
cas bool
|
||||||
@ -70,7 +70,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -172,14 +172,6 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Sets or updates data in the KV store"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) dataFromArgs(args []string) (string, string, error) {
|
func (c *cmd) dataFromArgs(args []string) (string, string, error) {
|
||||||
var stdin io.Reader = os.Stdin
|
var stdin io.Reader = os.Stdin
|
||||||
if c.testStdin != nil {
|
if c.testStdin != nil {
|
||||||
@ -225,7 +217,17 @@ func (c *cmd) dataFromArgs(args []string) (string, string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul kv put [options] KEY [DATA]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Sets or updates data in the KV store"
|
||||||
|
const help = `
|
||||||
|
Usage: consul kv put [options] KEY [DATA]
|
||||||
|
|
||||||
Writes the data to the given path in the key-value store. The data can be of
|
Writes the data to the given path in the key-value store. The data can be of
|
||||||
any type.
|
any type.
|
||||||
@ -255,4 +257,5 @@ const usage = `Usage: consul kv put [options] KEY [DATA]
|
|||||||
|
|
||||||
$ consul kv put -cas -modify-index=844 config/redis/maxconns 5
|
$ consul kv put -cas -modify-index=844 config/redis/maxconns 5
|
||||||
|
|
||||||
Additional flags and more advanced use cases are detailed below.`
|
Additional flags and more advanced use cases are detailed below.
|
||||||
|
`
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
func TestKVPutCommand_noTabs(t *testing.T) {
|
func TestKVPutCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -26,7 +26,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -56,13 +56,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Gracefully leaves the Consul cluster and shuts down"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul leave [options]
|
const synopsis = "Gracefully leaves the Consul cluster and shuts down"
|
||||||
|
const help = `
|
||||||
|
Usage: consul leave [options]
|
||||||
|
|
||||||
Causes the agent to gracefully leave the Consul cluster and shutdown.`
|
Causes the agent to gracefully leave the Consul cluster and shutdown.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestLeaveCommand_noTabs(t *testing.T) {
|
func TestLeaveCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
ShutdownCh <-chan struct{}
|
ShutdownCh <-chan struct{}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -445,12 +445,12 @@ func (c *cmd) killChild(childErr chan error) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return c.usage
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Help() string {
|
||||||
return "Execute a command holding a lock"
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
// LockUnlock is used to abstract over the differences between
|
// LockUnlock is used to abstract over the differences between
|
||||||
@ -463,7 +463,9 @@ type LockUnlock struct {
|
|||||||
rawOpts interface{}
|
rawOpts interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul lock [options] prefix child...
|
const synopsis = "Execute a command holding a lock"
|
||||||
|
const help = `
|
||||||
|
Usage: consul lock [options] prefix child...
|
||||||
|
|
||||||
Acquires a lock or semaphore at a given path, and invokes a child process
|
Acquires a lock or semaphore at a given path, and invokes a child process
|
||||||
when successful. The child process can assume the lock is held while it
|
when successful. The child process can assume the lock is held while it
|
||||||
@ -479,5 +481,4 @@ const usage = `Usage: consul lock [options] prefix child...
|
|||||||
holders to coordinate.
|
holders to coordinate.
|
||||||
|
|
||||||
The prefix provided must have write privileges.
|
The prefix provided must have write privileges.
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -27,7 +27,7 @@ func argFail(t *testing.T, args []string, expected string) {
|
|||||||
|
|
||||||
func TestLockCommand_noTabs(t *testing.T) {
|
func TestLockCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
// node or service maintenance mode.
|
// node or service maintenance mode.
|
||||||
type cmd struct {
|
type cmd struct {
|
||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
usage string
|
help string
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
|
|
||||||
@ -44,11 +44,7 @@ func (c *cmd) init() {
|
|||||||
c.flags.StringVar(&c.serviceID, "service", "",
|
c.flags.StringVar(&c.serviceID, "service", "",
|
||||||
"Control maintenance mode for a specific service ID.")
|
"Control maintenance mode for a specific service ID.")
|
||||||
|
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -152,10 +148,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Controls node or service maintenance mode"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul maint [options]
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Controls node or service maintenance mode"
|
||||||
|
const help = `
|
||||||
|
Usage: consul maint [options]
|
||||||
|
|
||||||
Places a node or service into maintenance mode. During maintenance mode,
|
Places a node or service into maintenance mode. During maintenance mode,
|
||||||
the node or service will be excluded from all queries through the DNS
|
the node or service will be excluded from all queries through the DNS
|
||||||
@ -177,5 +179,4 @@ const usage = `Usage: consul maint [options]
|
|||||||
|
|
||||||
If no arguments are given, the agent's maintenance status will be shown.
|
If no arguments are given, the agent's maintenance status will be shown.
|
||||||
This will return blank if nothing is currently under maintenance.
|
This will return blank if nothing is currently under maintenance.
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func TestMaintCommand_noTabs(t *testing.T) {
|
func TestMaintCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
// Consul agent what members are part of the cluster currently.
|
// Consul agent what members are part of the cluster currently.
|
||||||
type cmd struct {
|
type cmd struct {
|
||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
usage string
|
help string
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
// flags
|
// flags
|
||||||
@ -51,11 +51,7 @@ func (c *cmd) init() {
|
|||||||
c.flags.StringVar(&c.segment, "segment", consulapi.AllSegments,
|
c.flags.StringVar(&c.segment, "segment", consulapi.AllSegments,
|
||||||
"(Enterprise-only) If provided, output is filtered to only nodes in"+
|
"(Enterprise-only) If provided, output is filtered to only nodes in"+
|
||||||
"the given segment.")
|
"the given segment.")
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -213,12 +209,16 @@ func (c *cmd) detailedOutput(members []*consulapi.AgentMember) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Lists the members of a Consul cluster"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Lists the members of a Consul cluster"
|
||||||
|
const help = `
|
||||||
Usage: consul members [options]
|
Usage: consul members [options]
|
||||||
|
|
||||||
Outputs the members of a running Consul agent.
|
Outputs the members of a running Consul agent.
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func TestMembersCommand_noTabs(t *testing.T) {
|
func TestMembersCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
// Consul agent what members are part of the cluster currently.
|
// Consul agent what members are part of the cluster currently.
|
||||||
type cmd struct {
|
type cmd struct {
|
||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
usage string
|
help string
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
|
|
||||||
@ -40,11 +40,7 @@ func (c *cmd) init() {
|
|||||||
c.flags.StringVar(&c.logLevel, "log-level", "INFO",
|
c.flags.StringVar(&c.logLevel, "log-level", "INFO",
|
||||||
"Log level of the agent.")
|
"Log level of the agent.")
|
||||||
|
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -100,10 +96,15 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Stream logs from a Consul agent"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Stream logs from a Consul agent"
|
||||||
|
const help = `
|
||||||
Usage: consul monitor [options]
|
Usage: consul monitor [options]
|
||||||
|
|
||||||
Shows recent log messages of a Consul agent, and attaches to the agent,
|
Shows recent log messages of a Consul agent, and attaches to the agent,
|
||||||
@ -111,5 +112,4 @@ Usage: consul monitor [options]
|
|||||||
listen for log levels that may be filtered out of the Consul agent. For
|
listen for log levels that may be filtered out of the Consul agent. For
|
||||||
example your agent may only be logging at INFO level, but with the monitor
|
example your agent may only be logging at INFO level, but with the monitor
|
||||||
you can see the DEBUG level logs.
|
you can see the DEBUG level logs.
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -19,7 +19,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -27,15 +27,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Display the current Autopilot configuration"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -74,6 +66,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul operator autopilot get-config [options]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
Displays the current Autopilot configuration.`
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Display the current Autopilot configuration"
|
||||||
|
const help = `
|
||||||
|
Usage: consul operator autopilot get-config [options]
|
||||||
|
|
||||||
|
Displays the current Autopilot configuration.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestOperatorAutopilotGetConfigCommand_noTabs(t *testing.T) {
|
func TestOperatorAutopilotGetConfigCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package autopilot
|
package autopilot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/consul/command/flags"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,14 +16,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Provides tools for modifying Autopilot configuration"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
s := `Usage: consul operator autopilot <subcommand> [options]
|
return flags.Usage(help, nil, nil, nil)
|
||||||
|
|
||||||
The Autopilot operator command is used to interact with Consul's Autopilot
|
|
||||||
subsystem. The command can be used to view or modify the current configuration.`
|
|
||||||
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const synopsis = "Provides tools for modifying Autopilot configuration"
|
||||||
|
const help = `
|
||||||
|
Usage: consul operator autopilot <subcommand> [options]
|
||||||
|
|
||||||
|
The Autopilot operator command is used to interact with Consul's Autopilot
|
||||||
|
subsystem. The command can be used to view or modify the current configuration.
|
||||||
|
`
|
||||||
|
@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func TestOperatorAutopilotCommand_noTabs(t *testing.T) {
|
func TestOperatorAutopilotCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New().Help(), '\t') {
|
if strings.ContainsRune(New().Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
cleanupDeadServers flags.BoolValue
|
cleanupDeadServers flags.BoolValue
|
||||||
@ -62,15 +62,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Modify the current Autopilot configuration"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -129,6 +121,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul operator autopilot set-config [options]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
Modifies the current Autopilot configuration.`
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Modify the current Autopilot configuration"
|
||||||
|
const help = `
|
||||||
|
Usage: consul operator autopilot set-config [options]
|
||||||
|
|
||||||
|
Modifies the current Autopilot configuration.
|
||||||
|
`
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func TestOperatorAutopilotSetConfigCommand_noTabs(t *testing.T) {
|
func TestOperatorAutopilotSetConfigCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package operator
|
package operator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/consul/command/flags"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,11 +16,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Provides cluster-level tools for Consul operators"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
s := `Usage: consul operator <subcommand> [options]
|
return flags.Usage(help, nil, nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Provides cluster-level tools for Consul operators"
|
||||||
|
const help = `
|
||||||
|
Usage: consul operator <subcommand> [options]
|
||||||
|
|
||||||
Provides cluster-level tools for Consul operators, such as interacting with
|
Provides cluster-level tools for Consul operators, such as interacting with
|
||||||
the Raft subsystem. NOTE: Use this command with extreme caution, as improper
|
the Raft subsystem. NOTE: Use this command with extreme caution, as improper
|
||||||
@ -32,5 +38,3 @@ func (c *cmd) Help() string {
|
|||||||
Run consul operator <subcommand> with no arguments for help on that
|
Run consul operator <subcommand> with no arguments for help on that
|
||||||
subcommand.
|
subcommand.
|
||||||
`
|
`
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func TestOperatorCommand_noTabs(t *testing.T) {
|
func TestOperatorCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New().Help(), '\t') {
|
if strings.ContainsRune(New().Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -28,15 +28,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Display the current Raft peer configuration"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -94,6 +86,17 @@ func raftListPeers(client *api.Client, stale bool) (string, error) {
|
|||||||
return columnize.SimpleFormat(result), nil
|
return columnize.SimpleFormat(result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul operator raft list-peers [options]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
Displays the current Raft peer configuration.`
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Display the current Raft peer configuration"
|
||||||
|
const help = `
|
||||||
|
Usage: consul operator raft list-peers [options]
|
||||||
|
|
||||||
|
Displays the current Raft peer configuration.
|
||||||
|
`
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func TestOperatorRaftListPeersCommand_noTabs(t *testing.T) {
|
func TestOperatorRaftListPeersCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package raft
|
package raft
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/consul/command/flags"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,17 +16,18 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Provides cluster-level tools for Consul operators"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
s := `
|
return flags.Usage(help, nil, nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Provides cluster-level tools for Consul operators"
|
||||||
|
const help = `
|
||||||
Usage: consul operator raft <subcommand> [options]
|
Usage: consul operator raft <subcommand> [options]
|
||||||
|
|
||||||
The Raft operator command is used to interact with Consul's Raft subsystem. The
|
The Raft operator command is used to interact with Consul's Raft subsystem. The
|
||||||
command can be used to verify Raft peers or in rare cases to recover quorum by
|
command can be used to verify Raft peers or in rare cases to recover quorum by
|
||||||
removing invalid peers.
|
removing invalid peers.
|
||||||
|
|
||||||
`
|
`
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func TestOperatorRaftCommand_noTabs(t *testing.T) {
|
func TestOperatorRaftCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New().Help(), '\t') {
|
if strings.ContainsRune(New().Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
address string
|
address string
|
||||||
@ -36,15 +36,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Remove a Consul server from the Raft configuration"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -99,13 +91,24 @@ func raftRemovePeers(address, id string, operator *api.Operator) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul operator raft remove-peer [options]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
Remove the Consul server with given -address from the Raft configuration.
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
There are rare cases where a peer may be left behind in the Raft quorum even
|
const synopsis = "Remove a Consul server from the Raft configuration"
|
||||||
though the server is no longer present and known to the cluster. This command
|
const help = `
|
||||||
can be used to remove the failed server so that it is no longer affects the Raft
|
Usage: consul operator raft remove-peer [options]
|
||||||
quorum. If the server still shows in the output of the "consul members" command,
|
|
||||||
it is preferable to clean up by simply running "consul force-leave" instead of
|
Remove the Consul server with given -address from the Raft configuration.
|
||||||
this command.`
|
|
||||||
|
There are rare cases where a peer may be left behind in the Raft quorum even
|
||||||
|
though the server is no longer present and known to the cluster. This command
|
||||||
|
can be used to remove the failed server so that it is no longer affects the Raft
|
||||||
|
quorum. If the server still shows in the output of the "consul members" command,
|
||||||
|
it is preferable to clean up by simply running "consul force-leave" instead of
|
||||||
|
this command.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestOperatorRaftRemovePeerCommand_noTabs(t *testing.T) {
|
func TestOperatorRaftRemovePeerCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -26,15 +26,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Triggers the agent to reload configuration files"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -57,7 +49,18 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul reload
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Triggers the agent to reload configuration files"
|
||||||
|
const help = `
|
||||||
|
Usage: consul reload
|
||||||
|
|
||||||
Causes the agent to reload configurations. This can be used instead
|
Causes the agent to reload configurations. This can be used instead
|
||||||
of sending the SIGHUP signal to the agent.`
|
of sending the SIGHUP signal to the agent.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestReloadCommand_noTabs(t *testing.T) {
|
func TestReloadCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
wan bool
|
wan bool
|
||||||
@ -34,15 +34,7 @@ func (c *cmd) init() {
|
|||||||
|
|
||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), nil)
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Estimates network round trip time between nodes"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -182,7 +174,17 @@ SHOW_RTT:
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul rtt [options] node1 [node2]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Estimates network round trip time between nodes"
|
||||||
|
const help = `
|
||||||
|
Usage: consul rtt [options] node1 [node2]
|
||||||
|
|
||||||
Estimates the round trip time between two nodes using Consul's network
|
Estimates the round trip time between two nodes using Consul's network
|
||||||
coordinate model of the cluster.
|
coordinate model of the cluster.
|
||||||
@ -198,4 +200,5 @@ const usage = `Usage: consul rtt [options] node1 [node2]
|
|||||||
|
|
||||||
It is not possible to measure between LAN coordinates and WAN coordinates
|
It is not possible to measure between LAN coordinates and WAN coordinates
|
||||||
because they are maintained by independent Serf gossip areas, so they are
|
because they are maintained by independent Serf gossip areas, so they are
|
||||||
not compatible.`
|
not compatible.
|
||||||
|
`
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func TestRTTCommand_noTabs(t *testing.T) {
|
func TestRTTCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,20 +21,12 @@ func New(ui cli.Ui) *cmd {
|
|||||||
type cmd struct {
|
type cmd struct {
|
||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
c.usage = flags.Usage(usage, c.flags, nil, nil)
|
c.help = flags.Usage(help, c.flags, nil, nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Displays information about a Consul snapshot file"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -85,7 +77,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul snapshot inspect [options] FILE
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Displays information about a Consul snapshot file"
|
||||||
|
const help = `
|
||||||
|
Usage: consul snapshot inspect [options] FILE
|
||||||
|
|
||||||
Displays information about a snapshot file on disk.
|
Displays information about a snapshot file on disk.
|
||||||
|
|
||||||
@ -93,4 +95,5 @@ const usage = `Usage: consul snapshot inspect [options] FILE
|
|||||||
|
|
||||||
$ consul snapshot inspect backup.snap
|
$ consul snapshot inspect backup.snap
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func TestSnapshotInpectCommand_noTabs(t *testing.T) {
|
func TestSnapshotInpectCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -27,15 +27,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Restores snapshot of Consul server state"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -83,7 +75,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul snapshot restore [options] FILE
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Restores snapshot of Consul server state"
|
||||||
|
const help = `
|
||||||
|
Usage: consul snapshot restore [options] FILE
|
||||||
|
|
||||||
Restores an atomic, point-in-time snapshot of the state of the Consul servers
|
Restores an atomic, point-in-time snapshot of the state of the Consul servers
|
||||||
which includes key/value entries, service catalog, prepared queries, sessions,
|
which includes key/value entries, service catalog, prepared queries, sessions,
|
||||||
@ -101,4 +103,5 @@ const usage = `Usage: consul snapshot restore [options] FILE
|
|||||||
|
|
||||||
$ consul snapshot restore backup.snap
|
$ consul snapshot restore backup.snap
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func TestSnapshotRestoreCommand_noTabs(t *testing.T) {
|
func TestSnapshotRestoreCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
@ -30,15 +30,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Saves snapshot of Consul server state"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -113,7 +105,17 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul snapshot save [options] FILE
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Saves snapshot of Consul server state"
|
||||||
|
const help = `
|
||||||
|
Usage: consul snapshot save [options] FILE
|
||||||
|
|
||||||
Retrieves an atomic, point-in-time snapshot of the state of the Consul servers
|
Retrieves an atomic, point-in-time snapshot of the state of the Consul servers
|
||||||
which includes key/value entries, service catalog, prepared queries, sessions,
|
which includes key/value entries, service catalog, prepared queries, sessions,
|
||||||
@ -131,4 +133,5 @@ const usage = `Usage: consul snapshot save [options] FILE
|
|||||||
|
|
||||||
$ consul snapshot save -stale backup.snap
|
$ consul snapshot save -stale backup.snap
|
||||||
|
|
||||||
For a full list of options and examples, please see the Consul documentation.`
|
For a full list of options and examples, please see the Consul documentation.
|
||||||
|
`
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func TestSnapshotSaveCommand_noTabs(t *testing.T) {
|
func TestSnapshotSaveCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func TestSnapshotSaveCommand_Validation(t *testing.T) {
|
func TestSnapshotSaveCommand_Validation(t *testing.T) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package snapshot
|
package snapshot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/consul/command/flags"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,11 +16,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Saves, restores and inspects snapshots of Consul server state"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return `Usage: consul snapshot <subcommand> [options] [args]
|
return flags.Usage(help, nil, nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Saves, restores and inspects snapshots of Consul server state"
|
||||||
|
const help = `
|
||||||
|
Usage: consul snapshot <subcommand> [options] [args]
|
||||||
|
|
||||||
This command has subcommands for saving, restoring, and inspecting the state
|
This command has subcommands for saving, restoring, and inspecting the state
|
||||||
of the Consul servers for disaster recovery. These are atomic, point-in-time
|
of the Consul servers for disaster recovery. These are atomic, point-in-time
|
||||||
@ -48,4 +54,3 @@ func (c *cmd) Help() string {
|
|||||||
|
|
||||||
For more examples, ask for subcommand help or view the documentation.
|
For more examples, ask for subcommand help or view the documentation.
|
||||||
`
|
`
|
||||||
}
|
|
||||||
|
@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func TestSnapshotCommand_noTabs(t *testing.T) {
|
func TestSnapshotCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New().Help(), '\t') {
|
if strings.ContainsRune(New().Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,14 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
quiet bool
|
quiet bool
|
||||||
usage string
|
help string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) init() {
|
func (c *cmd) init() {
|
||||||
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
c.flags.BoolVar(&c.quiet, "quiet", false,
|
c.flags.BoolVar(&c.quiet, "quiet", false,
|
||||||
"When given, a successful run will produce no output.")
|
"When given, a successful run will produce no output.")
|
||||||
c.usage = flags.Usage(usage, c.flags, nil, nil)
|
c.help = flags.Usage(help, c.flags, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -56,14 +56,16 @@ func (c *cmd) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
func (c *cmd) Synopsis() string {
|
||||||
return "Validate config files/directories"
|
return synopsis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
func (c *cmd) Help() string {
|
||||||
return c.usage
|
return c.help
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul validate [options] FILE_OR_DIRECTORY...
|
const synopsis = "Validate config files/directories"
|
||||||
|
const help = `
|
||||||
|
Usage: consul validate [options] FILE_OR_DIRECTORY...
|
||||||
|
|
||||||
Performs a basic sanity test on Consul configuration files. For each file
|
Performs a basic sanity test on Consul configuration files. For each file
|
||||||
or directory given, the validate command will attempt to parse the
|
or directory given, the validate command will attempt to parse the
|
||||||
@ -71,4 +73,5 @@ const usage = `Usage: consul validate [options] FILE_OR_DIRECTORY...
|
|||||||
This is useful to do a test of the configuration only, without actually
|
This is useful to do a test of the configuration only, without actually
|
||||||
starting the agent.
|
starting the agent.
|
||||||
|
|
||||||
Returns 0 if the configuration is valid, or 1 if there are problems.`
|
Returns 0 if the configuration is valid, or 1 if there are problems.
|
||||||
|
`
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func TestValidateCommand_noTabs(t *testing.T) {
|
func TestValidateCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(nil).Help(), '\t') {
|
if strings.ContainsRune(New(nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,14 +17,6 @@ type cmd struct {
|
|||||||
version string
|
version string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Prints the Consul version"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Run(_ []string) int {
|
func (c *cmd) Run(_ []string) int {
|
||||||
c.UI.Output(fmt.Sprintf("Consul %s", c.version))
|
c.UI.Output(fmt.Sprintf("Consul %s", c.version))
|
||||||
|
|
||||||
@ -43,3 +35,11 @@ func (c *cmd) Run(_ []string) int {
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Synopsis() string {
|
||||||
|
return "Prints the Consul version"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -9,6 +9,6 @@ import (
|
|||||||
|
|
||||||
func TestVersionCommand_noTabs(t *testing.T) {
|
func TestVersionCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi(), "").Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi(), "").Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ type cmd struct {
|
|||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
flags *flag.FlagSet
|
flags *flag.FlagSet
|
||||||
http *flags.HTTPFlags
|
http *flags.HTTPFlags
|
||||||
usage string
|
help string
|
||||||
|
|
||||||
shutdownCh <-chan struct{}
|
shutdownCh <-chan struct{}
|
||||||
|
|
||||||
@ -70,15 +70,7 @@ func (c *cmd) init() {
|
|||||||
c.http = &flags.HTTPFlags{}
|
c.http = &flags.HTTPFlags{}
|
||||||
flags.Merge(c.flags, c.http.ClientFlags())
|
flags.Merge(c.flags, c.http.ClientFlags())
|
||||||
flags.Merge(c.flags, c.http.ServerFlags())
|
flags.Merge(c.flags, c.http.ServerFlags())
|
||||||
c.usage = flags.Usage(usage, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Synopsis() string {
|
|
||||||
return "Watch for changes in Consul"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cmd) Help() string {
|
|
||||||
return c.usage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cmd) Run(args []string) int {
|
func (c *cmd) Run(args []string) int {
|
||||||
@ -241,11 +233,22 @@ func (c *cmd) Run(args []string) int {
|
|||||||
return errExit
|
return errExit
|
||||||
}
|
}
|
||||||
|
|
||||||
const usage = `Usage: consul watch [options] [child...]
|
func (c *cmd) Synopsis() string {
|
||||||
|
return synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cmd) Help() string {
|
||||||
|
return c.help
|
||||||
|
}
|
||||||
|
|
||||||
|
const synopsis = "Watch for changes in Consul"
|
||||||
|
const help = `
|
||||||
|
Usage: consul watch [options] [child...]
|
||||||
|
|
||||||
Watches for changes in a given data view from Consul. If a child process
|
Watches for changes in a given data view from Consul. If a child process
|
||||||
is specified, it will be invoked with the latest results on changes. Otherwise,
|
is specified, it will be invoked with the latest results on changes. Otherwise,
|
||||||
the latest values are dumped to stdout and the watch terminates.
|
the latest values are dumped to stdout and the watch terminates.
|
||||||
|
|
||||||
Providing the watch type is required, and other parameters may be required
|
Providing the watch type is required, and other parameters may be required
|
||||||
or supported depending on the watch type.`
|
or supported depending on the watch type.
|
||||||
|
`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestWatchCommand_noTabs(t *testing.T) {
|
func TestWatchCommand_noTabs(t *testing.T) {
|
||||||
if strings.ContainsRune(New(cli.NewMockUi(), nil).Help(), '\t') {
|
if strings.ContainsRune(New(cli.NewMockUi(), nil).Help(), '\t') {
|
||||||
t.Fatal("usage has tabs")
|
t.Fatal("help has tabs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user