GinShell.Utilities/Public/Ensure-GsEnvironment.ps1
|
function Ensure-GsEnvironment { param ( [ValidateSet('Variable', 'Registry', 'File', 'Folder', 'Executable', 'Module')] [string]$Type = 'Module', [string]$Name, [switch]$SetIfMissing = $false, [string]$Value = $null ) if (-not (Test-GsEnvironment -Type $Type -Name $Name)) { Write-GsLog -Message "$Type '$Name' not found." -Type Warning if ($SetIfMissing) { if ((-not $Value) -and ($Type -ne 'Module') -and ($Type -ne 'Folder')) { Write-GsLog -Message "Value is required to set $Type '$Name'." -Type Error return $false } # TODO: Implement Set-GsEnvironment to handle creating missing environment items throw "Set-GsEnvironment is not yet implemented. Cannot auto-create $Type '$Name'." } return $false } return $true } |