Merge pull request #2673 from RachaelLuo/feature/CmdInitEmptyArgs

Add arges check for karmadactl deinit
This commit is contained in:
karmada-bot 2022-11-07 09:48:29 +08:00 committed by GitHub
commit 60d04d2ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,14 @@ func NewCmdDeInit(parentCommand string) *cobra.Command {
Annotations: map[string]string{
util.TagCommandGroup: util.GroupClusterRegistration,
},
Args: func(cmd *cobra.Command, args []string) error {
for _, arg := range args {
if len(arg) > 0 {
return fmt.Errorf("%q does not take any arguments, got %q", cmd.CommandPath(), args)
}
}
return nil
},
}
flags := cmd.Flags()