docs:update help

This commit is contained in:
DrIOS
2024-06-08 14:03:55 -05:00
parent 7a9d2885f3
commit ef55447e67
4 changed files with 42 additions and 14 deletions

View File

@@ -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
}
}
}