Skip to content

Commit 7b9e12f

Browse files
authored
Merge pull request kubernetes-sigs#6868 from oscr/clusterctl-desc-cluster-error-msg
🌱 Improve clusterctl describe cluster error message
2 parents 03f62b1 + 7be761b commit 7b9e12f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/clusterctl/cmd/describe_cluster.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/fatih/color"
2727
"github.com/gobuffalo/flect"
2828
"github.com/olekukonko/tablewriter"
29+
"github.com/pkg/errors"
2930
"github.com/spf13/cobra"
3031
corev1 "k8s.io/api/core/v1"
3132
"k8s.io/apimachinery/pkg/util/duration"
@@ -94,7 +95,12 @@ var describeClusterClusterCmd = &cobra.Command{
9495
# e.g. show the infrastructure machine objects, no matter if the current state is already reported by the machine's Ready condition.
9596
clusterctl describe cluster test-1 --disable-no-echo`),
9697

97-
Args: cobra.ExactArgs(1),
98+
Args: func(cmd *cobra.Command, args []string) error {
99+
if len(args) != 1 {
100+
return errors.New("please specify a cluster name")
101+
}
102+
return nil
103+
},
98104
RunE: func(cmd *cobra.Command, args []string) error {
99105
return runDescribeCluster(args[0])
100106
},

0 commit comments

Comments
 (0)