Skip to content

Commit

Permalink
Merge pull request #121 from tw3n/get-kubeconfig-option-all
Browse files Browse the repository at this point in the history
Enable --all flag of get-kubeconfig (thanks to @tw3n )
  • Loading branch information
iwilltry42 authored Oct 10, 2019
2 parents b09a968 + 8362016 commit 5c00056
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,22 @@ func ListClusters(c *cli.Context) error {

// GetKubeConfig grabs the kubeconfig from the running cluster and prints the path to stdout
func GetKubeConfig(c *cli.Context) error {
cluster := c.String("name")
kubeConfigPath, err := getKubeConfig(cluster)
clusters, err := getClusters(c.Bool("all"), c.String("name"))
if err != nil {
return err
}

// output kubeconfig file path to stdout
fmt.Println(kubeConfigPath)
for _, cluster := range clusters {
kubeConfigPath, err := getKubeConfig(cluster.name)
if err != nil {
log.Println(err)
continue
}

// output kubeconfig file path to stdout
fmt.Println(kubeConfigPath)
}

return nil
}

Expand Down

0 comments on commit 5c00056

Please # to comment.