Plugins/Report.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Author: Miodrag Milic <miodrag.milic@gmail.com>
# Last Change: 10-Nov-2016.
<#
.SYNOPSIS
    Create different types of reports about the current run.
 
.DESCRIPTION
    The plugin saves state of all packages in a file that can be used locally or
    uploaded via other plugins to remote (such as Gist or Mail).
#>


param(
    $Info,

    # Type of the report, currently 'markdown' or 'text'
    [string] $Type = 'markdown',

    # Path where to save the report
    [string] $Path = 'Update-AUPackages.md',

    # Report parameters
    [HashTable] $Params
)

Write-Host "Saving $Type report: $Path"

$Type = "$PSScriptRoot\Report\$Type.ps1"
if (!(Test-Path $Type )) { throw "Report type not found: '$Type" }

$result = & $Type
$result | Out-File $Path