docs:update help
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function Merge-CISExcelAndCsvData {
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(DefaultParameterSetName = 'CsvInput')]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ExcelPath,
|
||||
@@ -7,16 +7,25 @@ function Merge-CISExcelAndCsvData {
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$WorksheetName,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$CsvPath
|
||||
[Parameter(Mandatory = $true, ParameterSetName = 'CsvInput')]
|
||||
[string]$CsvPath,
|
||||
|
||||
[Parameter(Mandatory = $true, ParameterSetName = 'ObjectInput')]
|
||||
[CISAuditResult[]]$AuditResults
|
||||
)
|
||||
|
||||
process {
|
||||
# Import data from Excel and CSV
|
||||
# Import data from Excel
|
||||
$import = Import-Excel -Path $ExcelPath -WorksheetName $WorksheetName
|
||||
$csvData = Import-Csv -Path $CsvPath
|
||||
|
||||
# Iterate over each item in the imported Excel object and merge with CSV data
|
||||
# Import data from CSV or use provided object
|
||||
$csvData = if ($PSCmdlet.ParameterSetName -eq 'CsvInput') {
|
||||
Import-Csv -Path $CsvPath
|
||||
} else {
|
||||
$AuditResults
|
||||
}
|
||||
|
||||
# Iterate over each item in the imported Excel object and merge with CSV data or audit results
|
||||
$mergedData = foreach ($item in $import) {
|
||||
$csvRow = $csvData | Where-Object { $_.Rec -eq $item.'recommendation #' }
|
||||
if ($csvRow) {
|
||||
@@ -29,4 +38,4 @@ function Merge-CISExcelAndCsvData {
|
||||
# Return the merged data
|
||||
return $mergedData
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user