=Testing for old version of PowerShellGet
This commit is contained in:
parent
aa44d120e4
commit
91199f7bcf
|
@ -2,6 +2,21 @@ param([switch]$IgnoreSystem,[switch]$MissingOnly)
|
||||||
|
|
||||||
$local:currentSys = @('Always') + ([SystemName]::_GetValidValues('',$true,$true));
|
$local:currentSys = @('Always') + ([SystemName]::_GetValidValues('',$true,$true));
|
||||||
|
|
||||||
|
$local:oldPSGet = Get-Module PowerShellGet -ListAvailable -ErrorAction SilentlyContinue |
|
||||||
|
Sort-Object -Property Version -Descending |
|
||||||
|
Select-Object -First 1 |
|
||||||
|
Where-Object { $_.Version.Major -eq 1 }
|
||||||
|
if( $local:oldPSGet ) {
|
||||||
|
Write-Warning $(@(
|
||||||
|
"PowerShellGet is an old version ($($oldPSGet.Version)), the following code should upgrade it"
|
||||||
|
, " [Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
|
||||||
|
, " Install-PackageProvider -Name NuGet -Force"
|
||||||
|
, " Remove-Module PowerShellGet"
|
||||||
|
, " Install-Module -Name PowerShellGet -Force"
|
||||||
|
, " Update-Module -Name PowerShellGet"
|
||||||
|
) -join "`n" )
|
||||||
|
}
|
||||||
|
|
||||||
[MyConfig]::GetConfigPaths('mymodules',$false) |
|
[MyConfig]::GetConfigPaths('mymodules',$false) |
|
||||||
ForEach-Object {
|
ForEach-Object {
|
||||||
$local:modules = $( Get-Content $_ | ConvertFrom-Json );
|
$local:modules = $( Get-Content $_ | ConvertFrom-Json );
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Get-Command Set-PSReadLineKeyHandler | ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
|
Get-Command Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue |
|
||||||
|
ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
|
||||||
if( Get-Command Set-PoshPrompt -ErrorAction SilentlyContinue ) {
|
if( Get-Command Set-PoshPrompt -ErrorAction SilentlyContinue ) {
|
||||||
$local:poshPrompt = Join-Path $HOME ".oh-my-posh.omp.json"
|
$local:poshPrompt = Join-Path $HOME ".oh-my-posh.omp.json"
|
||||||
if( -not (Test-Path $poshPrompt) ) { $poshPrompt = "slim" }
|
if( -not (Test-Path $poshPrompt) ) { $poshPrompt = "slim" }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"Always": [
|
"Always": [
|
||||||
|
"psreadline",
|
||||||
"PowerShellCookbook",
|
"PowerShellCookbook",
|
||||||
"oh-my-posh",
|
"oh-my-posh",
|
||||||
"posh-git",
|
"posh-git",
|
||||||
|
|
Loading…
Reference in New Issue