Skip to content

Commit

Permalink
Improve clusterctl describe cluster error message
Browse files Browse the repository at this point in the history
  • Loading branch information
oscr committed Jul 7, 2022
1 parent 3d51907 commit 7be761b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/clusterctl/cmd/describe_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/fatih/color"
"github.com/gobuffalo/flect"
"github.com/olekukonko/tablewriter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/duration"
Expand Down Expand Up @@ -94,7 +95,12 @@ var describeClusterClusterCmd = &cobra.Command{
# e.g. show the infrastructure machine objects, no matter if the current state is already reported by the machine's Ready condition.
clusterctl describe cluster test-1 --disable-no-echo`),

Args: cobra.ExactArgs(1),
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("please specify a cluster name")
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return runDescribeCluster(args[0])
},
Expand Down

0 comments on commit 7be761b

Please sign in to comment.