github.com/landoop/schema-registry@v0.0.0-20190327143759-50a5701c1891/schema-registry-cli/cmd/get_config.go (about) 1 package cmd 2 3 import ( 4 "fmt" 5 6 "github.com/spf13/cobra" 7 ) 8 9 var getConfigCmd = &cobra.Command{ 10 Use: "get-config [subject]", 11 Short: "retrieves global or suject specific configuration", 12 Long: `Configuration can be requested for all or a specific subject. When "compatibility-level" 13 is not defined for a specific subject, then it's using global compatibility level. To check global 14 setting just call "get-config" without arguments. 15 Compatibility levels in Schema-Registry may be: "NONE", "BACKWARD", "FORWARD" and "FULL". Please 16 consider official documentation for more details. 17 `, 18 RunE: func(cmd *cobra.Command, args []string) error { 19 switch { 20 case len(args) > 1: 21 return fmt.Errorf("only one subject allowed") 22 case len(args) == 0: 23 if err := getConfig(""); err != nil { 24 return err 25 } 26 case len(args) == 1: 27 if err := getConfig(args[0]); err != nil { 28 return err 29 } 30 } 31 32 return nil 33 }, 34 } 35 36 func init() { 37 RootCmd.AddCommand(getConfigCmd) 38 }