2023-03-28 19:12:30 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2017-10-17 11:15:23 +00:00
|
|
|
package catalog
|
2017-07-14 19:45:08 +00:00
|
|
|
|
|
|
|
import (
|
2017-10-11 14:43:46 +00:00
|
|
|
"github.com/hashicorp/consul/command/flags"
|
2017-07-14 19:45:08 +00:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
2017-10-11 14:43:46 +00:00
|
|
|
func New() *cmd {
|
|
|
|
return &cmd{}
|
2017-07-14 19:45:08 +00:00
|
|
|
}
|
|
|
|
|
2017-10-11 14:43:46 +00:00
|
|
|
type cmd struct{}
|
|
|
|
|
|
|
|
func (c *cmd) Run(args []string) int {
|
2017-07-14 19:45:08 +00:00
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|
|
|
|
|
2017-10-11 14:43:46 +00:00
|
|
|
func (c *cmd) Synopsis() string {
|
2017-10-17 13:44:20 +00:00
|
|
|
return synopsis
|
2017-10-11 14:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Help() string {
|
2017-10-17 22:00:01 +00:00
|
|
|
return flags.Usage(help, nil)
|
2017-10-17 13:44:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const synopsis = "Interact with the catalog"
|
|
|
|
const help = `
|
|
|
|
Usage: consul catalog <subcommand> [options] [args]
|
2017-07-14 19:45:08 +00:00
|
|
|
|
|
|
|
This command has subcommands for interacting with Consul's catalog. The
|
|
|
|
catalog should not be confused with the agent, although the APIs and
|
|
|
|
responses may be similar.
|
|
|
|
|
|
|
|
Here are some simple examples, and more detailed examples are available
|
|
|
|
in the subcommands or the documentation.
|
|
|
|
|
|
|
|
List all datacenters:
|
|
|
|
|
|
|
|
$ consul catalog datacenters
|
|
|
|
|
|
|
|
List all nodes:
|
|
|
|
|
|
|
|
$ consul catalog nodes
|
|
|
|
|
|
|
|
List all services:
|
|
|
|
|
|
|
|
$ consul catalog services
|
|
|
|
|
2017-10-17 13:44:20 +00:00
|
|
|
For more examples, ask for subcommand help or view the documentation.
|
|
|
|
`
|