Skip to content

Commit

Permalink
fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
birdayz committed May 24, 2020
1 parent 2bab132 commit 0051cd1
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions cmd/kaf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
)

var (
flagEhConnString string
flagBrokerVersion string
flagEhConnString string
flagBrokerVersion string
)

func init() {
Expand Down Expand Up @@ -158,7 +158,7 @@ var configAddClusterCmd = &cobra.Command{
Name: name,
Brokers: brokersFlag,
SchemaRegistryURL: schemaRegistryURL,
Version: flagVersion,
Version: flagBrokerVersion,
})
err := cfg.Write()
if err != nil {
Expand All @@ -169,32 +169,32 @@ var configAddClusterCmd = &cobra.Command{
}

var configRemoveClusterCmd = &cobra.Command{
Use: "remove-cluster [NAME]",
Short: "remove cluster",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
name := args[0]

var pos = -1
for i, cluster := range cfg.Clusters {
if cluster.Name == name {
pos = i
break
}
}

if pos == -1 {
errorExit("Could not delete cluster: cluster with name '%v' not exists.", name)
}

cfg.Clusters = append(cfg.Clusters[:pos],cfg.Clusters[pos+1:]...)

err := cfg.Write()
if err != nil {
errorExit("Unable to write config: %v\n", err)
}
fmt.Println("Removed cluster.")
},
Use: "remove-cluster [NAME]",
Short: "remove cluster",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
name := args[0]

var pos = -1
for i, cluster := range cfg.Clusters {
if cluster.Name == name {
pos = i
break
}
}

if pos == -1 {
errorExit("Could not delete cluster: cluster with name '%v' not exists.", name)
}

cfg.Clusters = append(cfg.Clusters[:pos], cfg.Clusters[pos+1:]...)

err := cfg.Write()
if err != nil {
errorExit("Unable to write config: %v\n", err)
}
fmt.Println("Removed cluster.")
},
}

var configImportCmd = &cobra.Command{
Expand Down

0 comments on commit 0051cd1

Please sign in to comment.