diff --git a/posh-git.psm1 b/posh-git.psm1 index 2c14f8941..c8677d0d1 100644 --- a/posh-git.psm1 +++ b/posh-git.psm1 @@ -1,9 +1,12 @@ +param([switch]$NoVersionWarn = $false) + if (Get-Module posh-git) { return } -if ($PSVersionTable.PSVersion.Major -lt 3) { +if ($PSVersionTable.PSVersion.Major -lt 3 -and !$NoVersionWarn) { Write-Warning ("posh-git support for PowerShell 2.0 is deprecated; you have version $($Host.Version).`n" + "To download version 3.0, please visit https://www.microsoft.com/en-us/download/details.aspx?id=34595`n" + - "For more information and to discuss this, please visit https://github.com/dahlbyk/posh-git/issues/163`n") + "For more information and to discuss this, please visit https://github.com/dahlbyk/posh-git/issues/163`n" + + "To suppress this warning, change your profile to include 'Import-Module posh-git -Args `$true'.") } Push-Location $psScriptRoot