Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active January 3, 2023 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techthoughts2/2b3190cd0117acb79ac2306f00667a92 to your computer and use it in GitHub Desktop.
Save techthoughts2/2b3190cd0117acb79ac2306f00667a92 to your computer and use it in GitHub Desktop.
DynamicParam {
if (-not [String]::IsNullOrWhiteSpace($CICDChoice) -and $script:repoToCICD.ContainsKey($CICDChoice) ) {
$attrRepo = [System.Management.Automation.ParameterAttribute]::new()
$attrRepo.ParameterSetName = 'Choice'
$attrRepo.Mandatory = $true
$attrRepo.HelpMessage = 'TBD'
$attrRepoValidation = [System.Management.Automation.ValidateSetAttribute]::new([String[]]$script:repoToCICD[$CICDChoice])
$attributeCollection = [System.Collections.ObjectModel.Collection[System.Attribute]]::new()
$attributeCollection.Add($attrRepo)
$attributeCollection.Add($attrRepoValidation )
$param = [System.Management.Automation.RuntimeDefinedParameter]::new('Repository', [String], $attributeCollection)
$paramDict = [System.Management.Automation.RuntimeDefinedParameterDictionary]::new()
$paramDict.Add('Repository', $param)
return $paramDict
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment