chore: add KV options.

This commit is contained in:
Fernandez Ludovic 2019-04-20 14:26:25 +02:00
parent 6ebd39d55f
commit ecfe5ad331
5 changed files with 20 additions and 51 deletions

View File

@ -11,21 +11,15 @@ var boltdbCmd = &cobra.Command{
Use: "boltdb", Use: "boltdb",
Short: "TODO", Short: "TODO",
Long: `TODO`, Long: `TODO`,
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("boltdb called") fmt.Println("boltdb called")
return nil
}, },
} }
func init() { func init() {
kvCmd.AddCommand(boltdbCmd) kvCmd.AddCommand(boltdbCmd)
// Here you will define your flags and configuration settings. boltdbCmd.Flags().Bool("persist-connection", false, "Persist connection for boltdb.")
boltdbCmd.Flags().String("bucket", "traefik", "Bucket for boltdb.")
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// boltdbCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// boltdbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View File

@ -11,21 +11,14 @@ var consulCmd = &cobra.Command{
Use: "consul", Use: "consul",
Short: "TODO", Short: "TODO",
Long: `TODO`, Long: `TODO`,
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("consul called") fmt.Println("consul called")
return nil
}, },
} }
func init() { func init() {
kvCmd.AddCommand(consulCmd) kvCmd.AddCommand(consulCmd)
// Here you will define your flags and configuration settings. consulCmd.Flags().String("token", "", "Token for consul.")
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// consulCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// consulCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View File

@ -11,21 +11,14 @@ var etcdCmd = &cobra.Command{
Use: "etcd", Use: "etcd",
Short: "TODO", Short: "TODO",
Long: `TODO`, Long: `TODO`,
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("etcd called") fmt.Println("etcd called")
return nil
}, },
} }
func init() { func init() {
kvCmd.AddCommand(etcdCmd) kvCmd.AddCommand(etcdCmd)
// Here you will define your flags and configuration settings. etcdCmd.Flags().Int("sync-period", 0, "Sync period for etcd in seconds.")
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// etcdCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// etcdCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View File

@ -1,5 +1,3 @@
// Copyright © 2019 ldez <lfernandez.dev@gmail.com>
package cmd package cmd
import ( import (
@ -16,13 +14,13 @@ var kvCmd = &cobra.Command{
func init() { func init() {
rootCmd.AddCommand(kvCmd) rootCmd.AddCommand(kvCmd)
// Here you will define your flags and configuration settings. kvCmd.PersistentFlags().StringSlice("endpoints", []string{"localhost:8500"}, "Comma separated list of endpoints.")
kvCmd.PersistentFlags().Int("connection-timeout", 0, "Connection timeout in seconds.")
kvCmd.PersistentFlags().String("password", "", "Password for connection.")
kvCmd.PersistentFlags().String("username", "", "Username for connection.")
// Cobra supports Persistent Flags which will work for this command // FIXME review TLS parts
// and all subcommands, e.g.: kvCmd.PersistentFlags().Bool("tls.enable", false, "Enable TLS encryption.")
// kvCmd.PersistentFlags().String("foo", "", "A help for foo") kvCmd.PersistentFlags().Bool("tls.insecureskipverify", false, "Trust unverified certificates if TLS is enabled.")
kvCmd.PersistentFlags().String("tls.ca-cert-file", "", "Root CA file for certificate verification if TLS is enabled.")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// kvCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View File

@ -11,21 +11,12 @@ var zookeeperCmd = &cobra.Command{
Use: "zookeeper", Use: "zookeeper",
Short: "TODO", Short: "TODO",
Long: `TODO`, Long: `TODO`,
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("zookeeper called") fmt.Println("zookeeper called")
return nil
}, },
} }
func init() { func init() {
kvCmd.AddCommand(zookeeperCmd) kvCmd.AddCommand(zookeeperCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// zookeeperCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// zookeeperCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }