File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
2222 "io"
2323 "os"
2424
25+ "github.com/pkg/errors"
2526 "github.com/spf13/cobra"
2627 "github.com/spf13/pflag"
2728 "sigs.k8s.io/controller-runtime/pkg/client"
8283 Short : "Output shell completion code for the specified shell (bash or zsh)" ,
8384 Long : LongDesc (completionLong ),
8485 Example : completionExample ,
85- Args : cobra .ExactArgs (1 ),
86+ Args : func (cmd * cobra.Command , args []string ) error {
87+ if len (args ) != 1 {
88+ return errors .New ("please specify a shell" )
89+ }
90+ return nil
91+ },
8692 RunE : func (cmd * cobra.Command , args []string ) error {
8793 return runCompletion (os .Stdout , cmd , args [0 ])
8894 },
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package cmd
1919import (
2020 "fmt"
2121
22+ "github.com/pkg/errors"
2223 "github.com/spf13/cobra"
2324
2425 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
@@ -46,7 +47,12 @@ var getKubeconfigCmd = &cobra.Command{
4647 # Get the workload cluster's kubeconfig in a particular namespace.
4748 clusterctl get kubeconfig <name of workload cluster> --namespace foo` ),
4849
49- Args : cobra .ExactArgs (1 ),
50+ Args : func (cmd * cobra.Command , args []string ) error {
51+ if len (args ) != 1 {
52+ return errors .New ("please specify a workload cluster name" )
53+ }
54+ return nil
55+ },
5056 RunE : func (cmd * cobra.Command , args []string ) error {
5157 return runGetKubeconfig (args [0 ])
5258 },
You can’t perform that action at this time.
0 commit comments