2023-03-28 20:12:30 +01:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 09:12:13 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 20:12:30 +01:00
|
|
|
|
2017-10-17 13:15:23 +02:00
|
|
|
package catalog
|
2017-07-14 15:45:08 -04:00
|
|
|
|
|
|
|
import (
|
2017-10-11 16:43:46 +02:00
|
|
|
"github.com/hashicorp/consul/command/flags"
|
2017-07-14 15:45:08 -04:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
2017-10-11 16:43:46 +02:00
|
|
|
func New() *cmd {
|
|
|
|
return &cmd{}
|
2017-07-14 15:45:08 -04:00
|
|
|
}
|
|
|
|
|
2017-10-11 16:43:46 +02:00
|
|
|
type cmd struct{}
|
|
|
|
|
|
|
|
func (c *cmd) Run(args []string) int {
|
2017-07-14 15:45:08 -04:00
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|
|
|
|
|
2017-10-11 16:43:46 +02:00
|
|
|
func (c *cmd) Synopsis() string {
|
2017-10-17 15:44:20 +02:00
|
|
|
return synopsis
|
2017-10-11 16:43:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Help() string {
|
2017-10-18 00:00:01 +02:00
|
|
|
return flags.Usage(help, nil)
|
2017-10-17 15:44:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const synopsis = "Interact with the catalog"
|
|
|
|
const help = `
|
|
|
|
Usage: consul catalog <subcommand> [options] [args]
|
2017-07-14 15:45:08 -04: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 15:44:20 +02:00
|
|
|
For more examples, ask for subcommand help or view the documentation.
|
|
|
|
`
|