Skip to content

Commit

Permalink
#601 : Add functionality to open report after creation
Browse files Browse the repository at this point in the history
  • Loading branch information
qngngyn committed Aug 27, 2024
1 parent e4ed2a2 commit 574ac55
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ATAPHtmlReport/ATAPHtmlReport.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1918,12 +1918,21 @@ function Get-ATAPHtmlReport {
$name = Split-Path -Path $Path -Leaf
$Path = Split-Path -Path $Path -Parent
New-Item -Path $Path -Name $name -ItemType File -Value $html -Force

} else {
$Title = $Title -replace " Audit Report",""
$auditReport += "$($Title)_$(Get-Date -UFormat %Y%m%d_%H%M%S).html"
New-Item -Path $Path -Name $auditReport -ItemType File -Value $html -Force
}
if ($_) {
Write-Host "Do you want to open the created report? Y/N"
$in = Read-Host
Write-Host "You chose `"$in`""
switch ($in) {
Y { Get-ChildItem -Path $Path| Sort-Object LastWriteTime -Descending | Select-Object -First 1 | Invoke-Item }
N { "Continuing..."}
Default { "Continuing..." }
}
}
if([System.Environment]::OSVersion.Platform -eq 'Unix'){
# $shellPath = $Path"/"$name
# bash -c "chmod o+r $($shellPath)"
Expand All @@ -1932,4 +1941,5 @@ function Get-ATAPHtmlReport {
#Create Report file
#$html | Out-File -FilePath $auditReport -Encoding utf8
}
}
}

0 comments on commit 574ac55

Please sign in to comment.