-
-
Notifications
You must be signed in to change notification settings - Fork 176
/
PSKoans.ezformat.ps1
37 lines (32 loc) · 1.14 KB
/
PSKoans.ezformat.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
33
34
35
36
37
#requires -Module EZOut
# Install-Module EZOut or https://github.com/StartAutomating/EZOut
$myFile = $MyInvocation.MyCommand.ScriptBlock.File
$myModuleName = 'PSKoans'
$myRoot = "$PSScriptRoot"
Push-Location $myRoot
$formatting = @(
# Add your own Write-FormatView here,
# or put them in a Formatting or Views directory
foreach ($potentialDirectory in 'formatting', 'views') {
Join-Path $myRoot -ChildPath $potentialDirectory |
Get-ChildItem -ea ignore |
Import-FormatView -FilePath { $_.Fullname }
}
)
$destinationRoot = "$PSScriptRoot/PSKoans"
if ($formatting) {
$myFormatFile = Join-Path $destinationRoot "$myModuleName.format.ps1xml"
$formatting | Out-FormatData -Module $MyModuleName | Set-Content $myFormatFile -Encoding UTF8
}
$types = @(
# Add your own Write-TypeView statements here
# or declare them in the 'Types' directory
Join-Path $myRoot Types |
Get-Item -ea ignore |
Import-TypeView
)
if ($types) {
$myTypesFile = Join-Path $destinationRoot "$myModuleName.types.ps1xml"
$types | Out-TypeData | Set-Content $myTypesFile -Encoding UTF8
}
Pop-Location