add arges check

Signed-off-by: yipping.luo <yinping.luo@daocloud.io>
This commit is contained in:
yipping.luo 2022-10-22 23:42:29 +08:00
parent 875d2ef6c1
commit 1097c49674
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()