From fbe93eb039536d71fbac014fbe0314471bee0923 Mon Sep 17 00:00:00 2001 From: iwilltry42 Date: Thu, 7 Nov 2019 15:39:31 +0100 Subject: [PATCH] add more verbose error messages for getKubeconfig and Delete if no flag was set --- cli/commands.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli/commands.go b/cli/commands.go index 11874be9..9c0d460c 100644 --- a/cli/commands.go +++ b/cli/commands.go @@ -243,6 +243,7 @@ kubectl cluster-info`, os.Args[0], c.String("name")) // DeleteCluster removes the containers belonging to a cluster and its local directory func DeleteCluster(c *cli.Context) error { + clusters, err := getClusters(c.Bool("all"), c.String("name")) if err != nil { @@ -250,6 +251,9 @@ func DeleteCluster(c *cli.Context) error { } if len(clusters) == 0 { + if !c.IsSet("all") && !c.IsSet("name") { + return fmt.Errorf("No cluster with name '%s' found (You can add `--all` and `--name ` to delete other clusters)", c.String("name")) + } return fmt.Errorf("No cluster(s) found") } @@ -386,6 +390,9 @@ func GetKubeConfig(c *cli.Context) error { } if len(clusters) == 0 { + if !c.IsSet("all") && !c.IsSet("name") { + return fmt.Errorf("No cluster with name '%s' found (You can add `--all` and `--name ` to check other clusters)", c.String("name")) + } return fmt.Errorf("No cluster(s) found") }