Skip to content

Commit 077c707

Browse files
committed
allow choc upgrade
1 parent 26ca87c commit 077c707

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Modules/Scripts/Install-Chocolatey.ps1

+6-9
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
Can be used on new machines to install Chocolately. If already installed then
44
checks if it is outdated and prompts to update.
55
6-
.PARAMETER -Yes
7-
Upgrade without prompting if an update is available.
6+
.PARAMETER Upgrade
7+
Check if Chocolatey is outdated and update if it is.
88
#>
99

10-
param ([switch] $Yes)
10+
param ([switch] $Upgrade)
1111

1212
if (-not (Get-Command 'choco' -ErrorAction:Ignore))
1313
{
@@ -26,13 +26,10 @@ if (-not (Get-Command 'choco' -ErrorAction:Ignore))
2626
Write-Host 'Install'
2727
Invoke-Expression $installer
2828
}
29-
else
29+
elseif ($Upgrade)
3030
{
31-
choco outdated -r
32-
33-
# TODO: react...
34-
if ($Yes)
31+
(choco outdated -r) | % { $_ -match 'chocolatey\|'} | % `
3532
{
36-
# blah...
33+
choco upgrade chocolatey -y
3734
}
3835
}

0 commit comments

Comments
 (0)