Skip to content

Instantly share code, notes, and snippets.

@steviecoaster
Last active February 11, 2019 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steviecoaster/00e47821f1ac569e7b5e791f21902589 to your computer and use it in GitHub Desktop.
Save steviecoaster/00e47821f1ac569e7b5e791f21902589 to your computer and use it in GitHub Desktop.
Interact with the chocolatey community repository directly in Powershell
function Open-ChocolateyRepoUrl {
<#
.SYNOPSIS
Open Chocolatey repo urls directly from Powershell
.PARAMETER Search
The term to search for on the repo
.PARAMETER PackageName
If the exact package name is known, open it directly
.PARAMETER Version
Specify the version you wish to inspect
.EXAMPLE
Open-ChocolateyRepoUrl -Search pdf
.EXAMPLE
Open-ChocolateyRepoUrl -PackageName adobereader
.EXAMPLE
Open-ChocolateyRepoUrl -PackageName adobereader -Version 2018.011.20058
#>
[cmdletBinding()]
param(
[Parameter()]
[String]
$Search,
[Parameter()]
[String]
$PackageName
)
begin {}
process {
if($Search){
Start-Process -Path "https://chocolatey.org/packages?q=$Search"
}
if($PackageName){
Start-Process -Path "https://chocolatey.org/packages/$PackageName"
}
if($PSBoundParameters.ContainsKey('Version')) {
Start-Process -Path "https://chocolatey.org/packages/$PackageName/$Version"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment