functions/Write-SBOMComponents.ps1
function Write-SBOMComponents { param ( $fileName, $sum, $type ) $components = Import-Csv $fileName | Select-Object -Property name, license $componentsHashtable = @{} $components | ForEach-Object { if($_.License -eq ""){ $componentsHashtable[$_.Name] = "Unspecified" } else{ $componentsHashtable[$_.Name] = $_.License } } $componentsString = "" foreach ($row in $componentsHashtable.GetEnumerator()){ $componentsString += "$($row.Name) : $($row.Value)`n" } $content = "There are $($sum) $($type) components in this build, please review the $($fileName) and make appropriate changes `n$($componentsString)" return $content } |