diff --git a/cmd/kaf/config.go b/cmd/kaf/config.go index e942381d..e5e70a01 100644 --- a/cmd/kaf/config.go +++ b/cmd/kaf/config.go @@ -11,6 +11,7 @@ func init() { configCmd.AddCommand(configImportCmd) configCmd.AddCommand(configUseCmd) configCmd.AddCommand(configLsCmd) + configCmd.AddCommand(configAddClusterCmd) rootCmd.AddCommand(configCmd) } @@ -48,6 +49,23 @@ var configLsCmd = &cobra.Command{ }, } +var configAddClusterCmd = &cobra.Command{ + Use: "add-cluster [NAME]", + Short: "add cluster", + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + config.Clusters = append(config.Clusters, &kaf.Cluster{ + Name: args[0], + Brokers: brokersFlag, + }) + err := config.Write() + if err != nil { + panic(err) + } + fmt.Println("Added cluster.") + }, +} + var configImportCmd = &cobra.Command{ Use: "import [ccloud]", Short: "Import configurations into the $HOME/.kaf/config file",