From bcef904d18363c705e366e7543b409ec3eebe6fb Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Tue, 19 Apr 2022 11:32:14 -0400 Subject: [PATCH] update make validate-cyclonedx-schema Signed-off-by: Christopher Phillips --- cmd/syft/cli/commands.go | 2 +- cmd/syft/cli/options/packages.go | 6 ++++-- internal/config/application.go | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/syft/cli/commands.go b/cmd/syft/cli/commands.go index b8373c1906bd..51ae5c63a2e1 100644 --- a/cmd/syft/cli/commands.go +++ b/cmd/syft/cli/commands.go @@ -29,7 +29,7 @@ func New() *cobra.Command { // e.g. pod.context = APPNAME_POD_CONTEXT v := viper.NewWithOptions(viper.EnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))) - // since root is aliased as packages we need to construct this command first + // since root is aliased as the packages cmd we need to construct this command first packagesCmd := Packages(v, app, ro, po) // rootCmd is currently an alias for the packages command diff --git a/cmd/syft/cli/options/packages.go b/cmd/syft/cli/options/packages.go index 6e1e6d27527f..4aa32024c8cf 100644 --- a/cmd/syft/cli/options/packages.go +++ b/cmd/syft/cli/options/packages.go @@ -69,8 +69,6 @@ func (o *PackagesOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error { func bindPackageConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error { // Formatting & Input options ////////////////////////////////////////////// - // note: output is not included since this configuration option is shared between multiple subcommands - if err := v.BindPFlag("package.cataloger.scope", flags.Lookup("scope")); err != nil { return err } @@ -83,6 +81,10 @@ func bindPackageConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error { return err } + if err := v.BindPFlag("output", flags.Lookup("output")); err != nil { + return err + } + // Upload options ////////////////////////////////////////////////////////// if err := v.BindPFlag("anchore.host", flags.Lookup("host")); err != nil { diff --git a/internal/config/application.go b/internal/config/application.go index aa8a1800ede3..abb3d9e74476 100644 --- a/internal/config/application.go +++ b/internal/config/application.go @@ -199,7 +199,6 @@ func loadConfig(v *viper.Viper, configPath string) error { } // start searching for valid configs in order... - // 1. look for ..yaml (in the current directory) v.AddConfigPath(".") v.SetConfigName("." + internal.ApplicationName) @@ -245,6 +244,5 @@ func loadConfig(v *viper.Viper, configPath string) error { } else if !errors.As(err, &viper.ConfigFileNotFoundError{}) { return fmt.Errorf("unable to parse config=%q: %w", v.ConfigFileUsed(), err) } - return nil }