Version Check the Posh-Git module to allow module autoloading

Posh-Git before this release does not export `Write-VcsStatus` thus
powershell's autoloading cannot find the reqired module for the function.

note that `get-module -listAvailable` can return an array of multiple
versions.
This commit is contained in:
Jackbennett 2016-10-10 12:01:55 +01:00
parent b349b19869
commit db909451c9

7
vendor/profile.ps1 vendored
View File

@ -49,9 +49,14 @@ try {
$gitLoaded = $false
function Import-Git($Loaded){
if($Loaded) { return }
if(-not (Get-Module -Name Posh-Git -ListAvailable) ) {
$GitModule = Get-Module -Name Posh-Git -ListAvailable
if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){
Import-Module Posh-Git > $null
}
if(-not ($GitModule) ) {
Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder."
}
# Make sure we only run once by alawys returning true
return $true
}