AL/Get-DependencyFromEnvironment.ps1
<# .Synopsis Retrieves dependency information from the settings.json .Description Retrieves the information for a specified dependency defined in the settings.json .Parameter SourcePath Path to the current project .Parameter Name Name of the dependency .Example $info = Get-DependencyFromEnvironment -SourcePath "C:\Install" -Name "App" #> function Get-DependencyFromEnvironment { Param( [Parameter(Mandatory=$true)] [string]$SourcePath, [Parameter(Mandatory=$true)] [string]$Name ) $dependencies = Get-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'dependencies' if ($null -ne $dependencies) { if ($dependencies -ne '') { return $dependencies | Where-Object name -eq $Name } } return @() } |