Private/Assert-CommandAvailable.ps1
|
function Assert-CommandAvailable { [CmdletBinding()] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$CommandName, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$InstallHint ) if (-not (Get-Command -Name $CommandName -ErrorAction SilentlyContinue)) { throw [System.Management.Automation.CommandNotFoundException]::new( "Required command '$CommandName' was not found. $InstallHint" ) } } |