Version 0.5.0

This commit is contained in:
dfrancis-adm
2019-07-26 10:52:42 -04:00
parent 9e3cc4ed81
commit 2d33bbfa8a
11 changed files with 90 additions and 9 deletions

View File

@@ -0,0 +1,34 @@
function Get-LatestChocoPackage {
<#
.SYNOPSIS
Get the latest version of one or more packages from the Chocolatey community repository.
.EXAMPLE
PS C:\Chocotemp> Get-LatestChocoPackage -PackageName googlechrome,firefox
Name CurrentVersion Version Pinned
---- -------------- ------- ------
GoogleChrome 75.0.3770.142 75.0.3770.142 No
Firefox 68.0.1 68.0.1 No
#>
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string[]]$PackageNames
)
$PackageNames | ForEach-Object {
$LatestPackage = (choco list $_ --exact --source=chocolatey -r)
if ($LatestPackage){
[PSCustomObject]@{
Name = $LatestPackage.Split('|')[0]
CurrentVersion = 'None'
Version = $LatestPackage.Split('|')[1]
Pinned = 'No'
}
}
else {
Write-Error "Could not find latest version of package $_"
}
}
}