Plugins/Report/text.ps1
$UserMessage = $Params.UserMessage $Title = if ($Params.Title) { $Params.Title } else { 'Update-AUPackages' } #============================================================================== function title($txt) { "`r`n{0}`r`n{1}`r`n" -f $txt,('-'*$txt.Length) } function indent($txt, $level=4) { $txt -split "`n" | % { ' '*$level + $_ } } $now = $Info.startTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm') $au_version = gmo au -ListAvailable | % Version | select -First 1 | % { "$_" } $package_no = $Info.result.all.Length "{0,-15}{1}" -f 'Title:', $Title "{0,-15}{1}" -f 'Time:', $now "{0,-15}{1}" -f 'AU version:', $au_version "{0,-15}{1}" -f 'AU packages:', $package_no $errors_word = if ($Info.error_count.total -eq 1) {'error'} else {'errors' } if ($Info.error_count.total) { "LAST RUN HAD $($Info.error_count.total) $errors_word !!!" } else { "Last run was OK" } ""; $Info.stats ""; $UserMessage; "" if ($Info.pushed) { title Pushed $Info.result.pushed | select 'Name', 'Updated', 'Pushed', 'RemoteVersion', 'NuspecVersion' | ft | Out-String | set r indent $r 2 $Info.result.pushed | % { $_.Name; indent $_.Result; "" } } if ($Info.error_count.total) { title Errors $Info.result.errors | select 'Name', 'NuspecVersion', 'Error' | ft | Out-String | set r indent $r 2 $Info.result.errors | % { $_.Name; indent $_.Error; "" } } if ($Info.result.ignored) { title Ignored $Info.result.ignored | ft | select 'Name', 'NuspecVersion', 'IgnoreMessage' | ft | Out-String | set r indent $r 2 } $ok = $Info.result.ok | ? { !$_.Pushed } if ($ok) { title OK $ok | select 'Name', 'Updated', 'RemoteVersion', 'NuspecVersion' | ft | Out-String | set r indent $r 2 $ok | % { $_.Name; indent $_.Result; "" } } |