Skip to content

Commit 955e2af

Browse files
committed
Allow specifying optional component name
1 parent 3cd47ce commit 955e2af

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func main() {
132132
rootCmd.Flags().String("tag", "", "Tag value to set in the document wrapper upload meta (optional, e.g. govulncheck)")
133133
rootCmd.Flags().String("software-id", "", "Kusari Platform Software ID value to set in the document wrapper upload meta (optional)")
134134
rootCmd.Flags().String("sbom-subject", "", "Kusari Platform Software sbom subject substring value to set in the document wrapper upload meta (optional)")
135+
rootCmd.Flags().String("component-name", "", "Kusari Platform component name (optional)")
135136

136137
// Bind flags to Viper with error handling
137138
mustBindPFlag(rootCmd, "file-path")
@@ -145,6 +146,7 @@ func main() {
145146
mustBindPFlag(rootCmd, "tag")
146147
mustBindPFlag(rootCmd, "software-id")
147148
mustBindPFlag(rootCmd, "sbom-subject")
149+
mustBindPFlag(rootCmd, "component-name")
148150

149151
// Allow environment variables
150152
viper.SetEnvPrefix("UPLOADER")
@@ -203,6 +205,7 @@ func uploadFiles(cmd *cobra.Command, args []string) {
203205
tag := viper.GetString("tag")
204206
softwareID := viper.GetString("software-id")
205207
sbomSubject := viper.GetString("sbom-subject")
208+
componentName := viper.GetString("component-name")
206209

207210
// Validate required configuration
208211
if filePath == "" || clientID == "" || clientSecret == "" ||
@@ -246,6 +249,9 @@ func uploadFiles(cmd *cobra.Command, args []string) {
246249
if sbomSubject != "" {
247250
uploadMeta["sbom_subject"] = sbomSubject
248251
}
252+
if componentName != "" {
253+
uploadMeta["component_name"] = componentName
254+
}
249255

250256
// Upload based on file type
251257
if fileInfo.IsDir() {

0 commit comments

Comments
 (0)