Created
January 29, 2024 17:15
-
-
Save lucax88x/df86f70634c3f0a9a13fdc4f37a2c6c5 to your computer and use it in GitHub Desktop.
filter-nuget.ps1
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 FilterNugetPackages | |
{ | |
param ( | |
[string[]]$Nugets, | |
[string]$Include = '', | |
[string]$Exclude = '' | |
) | |
if ($Include -eq "" -and $Exclude -eq "") | |
{ | |
return $Nugets | |
} | |
if ($Include -ne "" -and $Exclude -ne "") | |
{ | |
return $Nugets | Where-Object { $_ -match $Include -and $_ -notmatch $Exclude } | |
} | |
if ($Include -ne "") | |
{ | |
return $Nugets | Where-Object { $_ -match $Include } | |
} | |
return $Nugets | Where-Object { $_ -notmatch $Exclude } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment