-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Something like
$psakeBootstrap = ".\run.ps1"
$buildscript = ".\default.ps1"
function Set-Tasks() {
$tasks = (Select-String -Path $buildscript -Pattern "task \w+(\-)?\w+").matches | ForEach-Object { $_.Value.Split(" ")[1] } | Sort-Object
$taskListString = [string]::Join("','",$tasks)
$content = get-content $psakeBootstrap | ForEach-Object { $_ -replace "\[ValidateSet.*\]", "[ValidateSet('$taskListString')]" }
$content | Out-File -FilePath $psakeBootstrap -Encoding ascii
}
Export-ModuleMember -Function Set-Tasksand in 'run.ps1'
Remove-Module [S]et-Tasks
Import-Module ".\Set-Tasks.psm1"
Set-Taskswhich will just overwrite the [ValidateSet( line on itself
super hacky but just an idea
Using Psake's built-in Get-PSakeScriptTasks | Select-Object { $_.name } is probably a better idea