Merge pull request #142 from anchore/args-fix

cmd: allow no args passed, don't error
This commit is contained in:
Alfredo Deza 2020-08-11 08:29:28 -04:00 committed by GitHub
commit 691e26d3a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,8 +28,16 @@ Supports the following image sources:
`, map[string]interface{}{ `, map[string]interface{}{
"appName": internal.ApplicationName, "appName": internal.ApplicationName,
}), }),
Args: cobra.ExactArgs(1), Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
err := cmd.Help()
if err != nil {
log.Errorf(err.Error())
os.Exit(1)
}
os.Exit(1)
}
err := doRunCmd(cmd, args) err := doRunCmd(cmd, args)
if err != nil { if err != nil {
log.Errorf(err.Error()) log.Errorf(err.Error())