diff --git a/pkg/bom/doc.go b/pkg/bom/doc.go index 7b83b47..24fc4f9 100644 --- a/pkg/bom/doc.go +++ b/pkg/bom/doc.go @@ -49,8 +49,9 @@ func MergeMaps[K comparable, V any](map1 map[K]V, map2 map[K]V) map[K]V { } // MergeDocuments in a given dir. -func MergeDocuments(dir, name, author, organization, output string) error { +func MergeDocuments(dir, namespace, name, author, organization, output string) error { sdoc := spdx.NewDocument() + sdoc.Namespace = namespace sdoc.Name = name sdoc.Creator.Person = author sdoc.Creator.Organization = organization diff --git a/pkg/cli/merge.go b/pkg/cli/merge.go index 5dd84ac..4e05890 100644 --- a/pkg/cli/merge.go +++ b/pkg/cli/merge.go @@ -16,6 +16,7 @@ stacker-bom merge --dir --output --name func MergeCmd() *cobra.Command { dir := "" output := "" + namespace := "" name := "" cmd := &cobra.Command{ @@ -27,7 +28,7 @@ func MergeCmd() *cobra.Command { zerolog.SetGlobalLevel(zerolog.DebugLevel) } - if err := bom.MergeDocuments(dir, name, Author, Organization, output); err != nil { + if err := bom.MergeDocuments(dir, namespace, name, Author, Organization, output); err != nil { log.Error().Err(err).Msg("merge failed") os.Exit(1) } @@ -38,6 +39,8 @@ func MergeCmd() *cobra.Command { _ = cmd.MarkFlagRequired("dir") cmd.Flags().StringVarP(&output, "output", "o", "", "output SBOM file") _ = cmd.MarkFlagRequired("output") + cmd.Flags().StringVarP(&namespace, "namespace", "s", "", "document namespace of output SBOM file") + _ = cmd.MarkFlagRequired("namespace") cmd.Flags().StringVarP(&name, "name", "n", "", "document name of output SBOM file") _ = cmd.MarkFlagRequired("name")