mirror of
https://github.com/anchore/syft.git
synced 2026-10-30 14:02:26 +01:00
Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
28 lines
612 B
Go
28 lines
612 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/anchore/clio"
|
|
)
|
|
|
|
func Root(app clio.Application, packagesCmd *cobra.Command) *cobra.Command {
|
|
id := app.ID()
|
|
|
|
opts := defaultPackagesOptions()
|
|
|
|
return app.SetupRootCommand(&cobra.Command{
|
|
Use: fmt.Sprintf("%s [SOURCE]", app.ID().Name),
|
|
Short: packagesCmd.Short,
|
|
Long: packagesCmd.Long,
|
|
Args: packagesCmd.Args,
|
|
Example: packagesCmd.Example,
|
|
PreRunE: applicationUpdateCheck(id, &opts.UpdateCheck),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return runPackages(id, opts, args[0])
|
|
},
|
|
}, opts)
|
|
}
|