-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.ps1
30 lines (27 loc) · 1.36 KB
/
build.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
. .\src\foil.ps1
$tempJsonArray = @()
$commands | ForEach-Object {
$Noun = $_.Noun
$NounOriginalCommandElements = $_.OriginalCommandElements ?? @()
$NounParameters = $_.Parameters ?? @()
$NounOutputHandlers = $_.OutputHandlers
$_.Verbs | ForEach-Object {
$VerbOriginalCommandElements = $_.OriginalCommandElements ?? @()
$VerbParameters = $_.Parameters ?? @()
$VerbOutputHandlers = $_.OutputHandlers
$tempJson = New-TemporaryFile
New-CrescendoCommand -Verb $_.Verb -Noun $Noun | ForEach-Object {
$_.OriginalName = $BaseOriginalName
# Order noun elements first, then verbs, then generic
$_.OriginalCommandElements = ($NounOriginalCommandElements + $VerbOriginalCommandElements + $BaseOriginalCommandElements)
$_.Description = 'PowerShell Crescendo wrapper for Chocolatey'
# Order noun parameters first, then verbes, then generic
$_.Parameters = ($NounParameters + $VerbParameters + $BaseParameters)
# Prefer verb handlers first, then noun, then generic
$_.OutputHandlers = ($VerbOutputHandlers ?? $NounOutputHandlers) ?? $BaseOutputHandlers
$_
} | ConvertTo-Json | Out-File $tempJson
$tempJsonArray += $tempJson
}
}
Export-CrescendoModule -ConfigurationFile $tempJsonArray -ModuleName .\src\Foil.psm1 -Force