Skip to content

Commit

Permalink
verify updated scripts work; make necessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed May 15, 2024
1 parent 01f9ad7 commit 986c46b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ if ($mods = Get-Module -ListAvailable -Name Microsoft.WinGet.Client)
Write-Host "WinGet Client module detected."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.

$needsUpdate = $false;
$needsUpdate = $true;
foreach ($mod in $mods)
{
if ($mod.Version -lt "1.8.1133")
if ($mod.Version -ge "1.8.1133")
{
$needsUpdate = $true;
$needsUpdate = $false;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ Enable-ExperimentalFeature PSFeedbackProvider
Write-Host "Enabling experimental feature: PSCommandNotFoundSuggestion"
Enable-ExperimentalFeature PSCommandNotFoundSuggestion

$wingetModule = Get-Module -ListAvailable -Name Microsoft.WinGet.Client
if ($wingetModule) {
if ($wingetModule.Version -ge "1.8.1133") {
$wingetModules = Get-Module -ListAvailable -Name Microsoft.WinGet.Client
if ($wingetModules) {

$moduleUpToDate = $false;
foreach ($mod in $wingetModules) {
if ($mod.Version -ge "1.8.1133") {
$moduleUpToDate = $true;
break;
}
}

if ($moduleUpToDate) {
Write-Host "WinGet Client module detected"
} else {
Write-Host "WinGet module needs to be updated. Run `"Update-Module -Name Microsoft.WinGet.Client`" to update `r`n"
Expand Down Expand Up @@ -60,7 +69,7 @@ elseif ((-not [string]::IsNullOrEmpty($profileContent)) -and ($profileContent.Co
else
{
Add-Content -Path $PROFILE -Value "`r`n#f45873b3-b655-43a6-b217-97c00aa0db58 PowerToys CommandNotFound module"
Add-Content -Path $PROFILE -Value "`r`nImport-Module -Name Microsoft.WinGet.CommandNotFound`""
Add-Content -Path $PROFILE -Value "`r`nImport-Module -Name Microsoft.WinGet.CommandNotFound"
Add-Content -Path $PROFILE -Value "#f45873b3-b655-43a6-b217-97c00aa0db58"
Write-Host "Module was successfully registered in the profile file."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
$wingetModule = Get-Module -ListAvailable -Name Microsoft.WinGet.Client
if ($wingetModule)
$wingetModules = Get-Module -ListAvailable -Name Microsoft.WinGet.Client
if ($wingetModules)
{
if ($wingetModule.Version -ge "1.8.1133")
$needsUpdate = $true;
foreach ($mod in $wingetModules)
{
Write-Host "WinGet Client module detected."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
} else {
Update-Module -Name Microsoft.WinGet.Client
if (Get-Module -ListAvailable -Name Microsoft.WinGet.Client)
if ($mod.Version -ge "1.8.1133")
{
$needsUpdate = $false;
break;
}
}

if ($needsUpdate)
{
Update-Module -Name Microsoft.WinGet.Client -Force
$wingetModules = Get-Module -ListAvailable -Name Microsoft.WinGet.Client
$updated = $false;
foreach ($mod in $wingetModules)
{
if ($mod.Version -ge "1.8.1133")
{
$updated = $true;
break;
}
}

if ($updated)
{
Write-Host "WinGet Client module updated."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
}
else
{
Write-Host "WinGet Client module detected."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
}
}
else
{
Write-Host "WinGet Client module detected."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
}
}
else {
Install-Module -Name Microsoft.WinGet.Client
Expand Down

0 comments on commit 986c46b

Please sign in to comment.