Last active
February 11, 2019 16:38
-
-
Save steviecoaster/00e47821f1ac569e7b5e791f21902589 to your computer and use it in GitHub Desktop.
Interact with the chocolatey community repository directly in Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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