mirror of https://github.com/k3s-io/k3s
validate args for kubectl config view
parent
1f0f4cd7eb
commit
f824b58ba2
|
@ -112,7 +112,7 @@ func (o *ApiResourcesOptions) Validate() error {
|
|||
|
||||
func (o *ApiResourcesOptions) Complete(cmd *cobra.Command, args []string) error {
|
||||
if len(args) != 0 {
|
||||
return cmdutil.UsageErrorf(cmd, "unexpected args: %v", args)
|
||||
return cmdutil.UsageErrorf(cmd, "unexpected arguments: %v", args)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ func NewCmdApiVersions(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||
|
||||
func (o *ApiVersionsOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
if len(args) != 0 {
|
||||
return cmdutil.UsageErrorf(cmd, "unexpected args: %v", args)
|
||||
return cmdutil.UsageErrorf(cmd, "unexpected arguments: %v", args)
|
||||
}
|
||||
var err error
|
||||
o.discoveryClient, err = f.ToDiscoveryClient()
|
||||
|
|
|
@ -82,7 +82,7 @@ func NewCmdConfigView(f cmdutil.Factory, streams genericclioptions.IOStreams, Co
|
|||
Long: view_long,
|
||||
Example: view_example,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(cmd))
|
||||
cmdutil.CheckErr(o.Complete(cmd, args))
|
||||
cmdutil.CheckErr(o.Validate())
|
||||
cmdutil.CheckErr(o.Run())
|
||||
},
|
||||
|
@ -99,7 +99,10 @@ func NewCmdConfigView(f cmdutil.Factory, streams genericclioptions.IOStreams, Co
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ViewOptions) Complete(cmd *cobra.Command) error {
|
||||
func (o *ViewOptions) Complete(cmd *cobra.Command, args []string) error {
|
||||
if len(args) != 0 {
|
||||
return cmdutil.UsageErrorf(cmd, "unexpected arguments: %v", args)
|
||||
}
|
||||
if o.ConfigAccess.IsExplicitFile() {
|
||||
if !o.Merge.Provided() {
|
||||
o.Merge.Set("false")
|
||||
|
|
Loading…
Reference in New Issue