diff --git a/cli/commands.go b/cli/commands.go index 36314083..8480599b 100644 --- a/cli/commands.go +++ b/cli/commands.go @@ -355,7 +355,7 @@ func DeleteCluster(c *cli.Context) error { } if len(clusters) == 0 { - if !c.IsSet("all") && !c.IsSet("name") { + 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") @@ -428,6 +428,13 @@ func StopCluster(c *cli.Context) error { return err } + 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 stop other clusters)", c.String("name")) + } + return fmt.Errorf("No cluster(s) found") + } + ctx := context.Background() docker, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { @@ -466,6 +473,13 @@ func StartCluster(c *cli.Context) error { return err } + 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 start other clusters)", c.String("name")) + } + return fmt.Errorf("No cluster(s) found") + } + ctx := context.Background() docker, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { @@ -528,7 +542,7 @@ func GetKubeConfig(c *cli.Context) error { } if len(clusters) == 0 { - if !c.IsSet("all") && !c.IsSet("name") { + 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")