Check args numbers before application start

Add a general args number validator for all client commands.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
Zhang Wei
2016-10-28 23:43:10 +08:00
parent f156f73c2a
commit b517076907
16 changed files with 74 additions and 20 deletions
+3 -3
View File
@@ -45,11 +45,11 @@ status of "ubuntu01" as "stopped" the following will delete resources held for
},
},
Action: func(context *cli.Context) error {
hasError := false
if !context.Args().Present() {
return fmt.Errorf("runc: \"delete\" requires a minimum of 1 argument")
if err := checkArgs(context, 1, minArgs); err != nil {
return err
}
hasError := false
factory, err := loadFactory(context)
if err != nil {
return err