mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
cmd: display help menu when no args are passed in - skip the error
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
87e6dc08ec
commit
c581a454f2
1 changed files with 9 additions and 2 deletions
11
cmd/root.go
11
cmd/root.go
|
@ -36,7 +36,7 @@ var rootCmd = &cobra.Command{
|
|||
`, map[string]interface{}{
|
||||
"appName": internal.ApplicationName,
|
||||
}),
|
||||
Args: cobra.ExactArgs(1),
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if appConfig.Dev.ProfileCPU {
|
||||
f, err := os.Create("cpu.profile")
|
||||
|
@ -49,7 +49,14 @@ var rootCmd = &cobra.Command{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(args) == 0 {
|
||||
err := cmd.Help()
|
||||
if err != nil {
|
||||
log.Errorf(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
err := runDefaultCmd(cmd, args)
|
||||
|
||||
if appConfig.Dev.ProfileCPU {
|
||||
|
|
Loading…
Reference in a new issue