mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
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:
parent
b349b19869
commit
db909451c9
7
vendor/profile.ps1
vendored
7
vendor/profile.ps1
vendored
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user