Skip to content

Commit

Permalink
tests pass adding package flags
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
  • Loading branch information
spiffcs committed Aug 25, 2022
1 parent f6e4380 commit 0beb5f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/syft/cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func New() (*cobra.Command, error) {
// root options are also passed to the attestCmd so that a user provided config location can be discovered
attestCmd := Attest(v, app, ro)
poweruserCmd := PowerUser(v, app, ro)
convertCmd := Convert(v, app, ro)
convertCmd := Convert(v, app, ro, po)

// rootCmd is currently an alias for the packages command
rootCmd := &cobra.Command{
Expand Down
9 changes: 8 additions & 1 deletion cmd/syft/cli/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"fmt"
"log"

"github.com/anchore/syft/cmd/syft/cli/convert"
"github.com/anchore/syft/cmd/syft/cli/options"
Expand All @@ -17,7 +18,7 @@ const (
`
)

func Convert(v *viper.Viper, app *config.Application, ro *options.RootOptions) *cobra.Command {
func Convert(v *viper.Viper, app *config.Application, ro *options.RootOptions, po *options.PackagesOptions) *cobra.Command {
cmd := &cobra.Command{
Use: "convert [SOURCE-SBOM] -o [FORMAT]",
Short: "Convert between SBOM formats",
Expand All @@ -43,5 +44,11 @@ func Convert(v *viper.Viper, app *config.Application, ro *options.RootOptions) *
return convert.Run(cmd.Context(), app, args)
},
}

err := po.AddFlags(cmd, v)
if err != nil {
log.Fatal(err)
}

return cmd
}
2 changes: 1 addition & 1 deletion cmd/syft/cli/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cli

import (
"fmt"
"github.com/anchore/syft/cmd/syft/cli/options"
"log"

"github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/cmd/syft/cli/packages"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/config"
Expand Down

0 comments on commit 0beb5f1

Please sign in to comment.