mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 19:32:13 +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:
		
							
								
								
									
										7
									
								
								vendor/profile.ps1
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/profile.ps1
									
									
									
									
										vendored
									
									
								
							@@ -49,9 +49,14 @@ try {
 | 
				
			|||||||
$gitLoaded = $false
 | 
					$gitLoaded = $false
 | 
				
			||||||
function Import-Git($Loaded){
 | 
					function Import-Git($Loaded){
 | 
				
			||||||
    if($Loaded) { return }
 | 
					    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."
 | 
					        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
 | 
					    return $true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user