Skip to content

Commit

Permalink
Merge pull request #142 from anchore/args-fix
Browse files Browse the repository at this point in the history
cmd: allow no args passed, don't error
  • Loading branch information
Alfredo Deza authored Aug 11, 2020
2 parents d7695ae + 3bcae04 commit 691e26d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ Supports the following image sources:
`, map[string]interface{}{
"appName": internal.ApplicationName,
}),
Args: cobra.ExactArgs(1),
Args: cobra.MaximumNArgs(1),
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)
if err != nil {
log.Errorf(err.Error())
Expand Down

0 comments on commit 691e26d

Please sign in to comment.