Skip to content

Commit 7c6268a

Browse files
committed
Code and UI enhancements
1 parent 85876b2 commit 7c6268a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

Src/Public/New-AsBuiltConfig.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ function New-AsBuiltConfig {
2121
param()
2222

2323
begin {
24-
#Clear-Host
2524
#Run section to prompt user for information about the As Built Report to be exported to JSON format (if saved)
2625
$global:Config = @{ }
27-
$DirectorySeparatorChar = [System.IO.Path]::DirectorySeparatorChar
2826
Initialize-LocalizedData -ModuleType 'Core' -ModuleBasePath (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -LanguageFile 'New-AsBuiltConfig'
2927

3028
}
3129

3230
process {
31+
Clear-Host
3332
#region Report configuration
3433
# Show As Built Report configuration banner
3534
Draw-AsciiBanner -Lines @($translate.ReportInfo.BannerTitle) -ExtraPadding 4 -TextColor 'Cyan' -BorderColor 'Cyan'
@@ -298,9 +297,10 @@ function New-AsBuiltConfig {
298297
Clear-Host
299298
# Show Rerport configuration banner
300299
Draw-AsciiBanner -Lines @($translate.ReportConfig.BannerTitle) -ExtraPadding 4 -TextColor 'Cyan' -BorderColor 'Cyan'
301-
$ReportConfigFolder = Read-Host -Prompt ($translate.ReportConfig.ReportConfigFolder -f $($Home + $DirectorySeparatorChar + "AsBuiltReport"))
300+
$DefaultConfigFolder = Join-Path -Path $Home -ChildPath "AsBuiltReport"
301+
$ReportConfigFolder = Read-Host -Prompt ($translate.ReportConfig.ReportConfigFolder -f $DefaultConfigFolder)
302302
if (($null -eq $ReportConfigFolder) -or ($ReportConfigFolder -eq "")) {
303-
$ReportConfigFolder = Join-Path -Path $Home -ChildPath "AsBuiltReport"
303+
$ReportConfigFolder = $DefaultConfigFolder
304304
}
305305

306306
#If the folder doesn't exist, create it
@@ -392,9 +392,10 @@ function New-AsBuiltConfig {
392392
$AsBuiltExportPath = $ReportConfigFolderPath
393393
}
394394
} else {
395-
$AsBuiltExportPath = Read-Host -Prompt ($translate.ReportConfig.AsBuiltExportPath -f $($Home + $DirectorySeparatorChar + 'AsBuiltReport'))
395+
$DefaultConfigFolder = Join-Path -Path $Home -ChildPath "AsBuiltReport"
396+
$AsBuiltExportPath = Read-Host -Prompt ($translate.ReportConfig.AsBuiltExportPath -f $DefaultConfigFolder)
396397
if (($null -eq $AsBuiltExportPath) -or ($AsBuiltExportPath -eq "")) {
397-
$AsBuiltExportPath = Join-Path -Path $Home -ChildPath "AsBuiltReport"
398+
$AsBuiltExportPath = $DefaultConfigFolder
398399
}
399400
}
400401
if (-not (Test-Path -Path $AsBuiltExportPath)) {

Src/Public/New-AsBuiltReport.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,11 @@ function New-AsBuiltReport {
483483
} else {
484484
# Show progress messages for non-verbose report generation
485485
Write-Host ($translate.ReportGenerating -f $($Report.Replace(".", " "))) -ForegroundColor Green
486-
Write-Host " Initializing report framework..." -ForegroundColor Cyan
486+
Write-Host "> Initializing report framework..." -ForegroundColor Cyan
487487

488488
try {
489489
$AsBuiltReport = Document $FileName {
490-
Write-Host " Loading document style..." -ForegroundColor Cyan
490+
Write-Host "> Loading document style..." -ForegroundColor Cyan
491491
# Set Document Style
492492
if ($StyleFilePath) {
493493
Write-PScriboMessage -Plugin "Document" -Message ($translate.ReportStyleScript -f $StyleFilePath)
@@ -498,7 +498,7 @@ function New-AsBuiltReport {
498498
. $StyleFilePath
499499
}
500500

501-
Write-Host " Connecting to target system and gathering data..." -ForegroundColor Cyan
501+
Write-Host "> Connecting to target system and gathering data..." -ForegroundColor Cyan
502502
# If Credential has been passed or previously created via Username/Password
503503
try {
504504
if ($Credential) {
@@ -514,11 +514,11 @@ function New-AsBuiltReport {
514514
} catch {
515515
Write-Error "Report module execution failed: $($_.Exception.Message)" -ErrorAction Stop
516516
}
517-
Write-Host " Building document structure..." -ForegroundColor Cyan
517+
Write-Host "> Building document structure..." -ForegroundColor Cyan
518518
}
519-
Write-Host " Exporting document..." -ForegroundColor Cyan
519+
Write-Host "> Exporting document..." -ForegroundColor Cyan
520520
} catch {
521-
Write-Host " Report generation failed" -ForegroundColor Red
521+
Write-Host "[FAILED] Report generation failed" -ForegroundColor Red
522522
throw
523523
}
524524
}

0 commit comments

Comments
 (0)