github.phpd.cn/hashicorp/consul@v1.4.5/command/catalog/catalog.go (about)

     1  package catalog
     2  
     3  import (
     4  	"github.com/hashicorp/consul/command/flags"
     5  	"github.com/mitchellh/cli"
     6  )
     7  
     8  func New() *cmd {
     9  	return &cmd{}
    10  }
    11  
    12  type cmd struct{}
    13  
    14  func (c *cmd) Run(args []string) int {
    15  	return cli.RunResultHelp
    16  }
    17  
    18  func (c *cmd) Synopsis() string {
    19  	return synopsis
    20  }
    21  
    22  func (c *cmd) Help() string {
    23  	return flags.Usage(help, nil)
    24  }
    25  
    26  const synopsis = "Interact with the catalog"
    27  const help = `
    28  Usage: consul catalog <subcommand> [options] [args]
    29  
    30    This command has subcommands for interacting with Consul's catalog. The
    31    catalog should not be confused with the agent, although the APIs and
    32    responses may be similar.
    33  
    34    Here are some simple examples, and more detailed examples are available
    35    in the subcommands or the documentation.
    36  
    37    List all datacenters:
    38  
    39        $ consul catalog datacenters
    40  
    41    List all nodes:
    42  
    43        $ consul catalog nodes
    44  
    45    List all services:
    46  
    47        $ consul catalog services
    48  
    49    For more examples, ask for subcommand help or view the documentation.
    50  `