github.com/Aestek/consul@v1.2.4-0.20190309222502-b2c31e33971a/command/kv/kv.go (about) 1 package kv 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 key-value store" 27 const help = ` 28 Usage: consul kv <subcommand> [options] [args] 29 30 This command has subcommands for interacting with Consul's key-value 31 store. Here are some simple examples, and more detailed examples are 32 available in the subcommands or the documentation. 33 34 Create or update the key named "redis/config/connections" with the value "5": 35 36 $ consul kv put redis/config/connections 5 37 38 Read this value back: 39 40 $ consul kv get redis/config/connections 41 42 Or get detailed key information: 43 44 $ consul kv get -detailed redis/config/connections 45 46 Finally, delete the key: 47 48 $ consul kv delete redis/config/connections 49 50 For more examples, ask for subcommand help or view the documentation. 51 `