-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix for Import-PSGetRepository in Windows PS #1460
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,13 +25,14 @@ function Import-PSGetRepository { | |
Microsoft.PowerShell.Utility\Write-Verbose ('Found {0} registered PowerShellGet repositories.' -f $PSGetRepositories.Count) | ||
|
||
if ($PSGetRepositories.Count) { | ||
$repos = $PSGetRepositories.Values | | ||
$repos = @( $PSGetRepositories.Values | | ||
Microsoft.PowerShell.Core\Where-Object {$_.PackageManagementProvider -eq 'NuGet'-and $_.Name -ne 'PSGallery'} | | ||
Microsoft.PowerShell.Utility\Select-Object Name, Trusted, SourceLocation | ||
) | ||
|
||
Microsoft.PowerShell.Utility\Write-Verbose ('Selected {0} NuGet repositories.' -f $repos.Count) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alerickson: The issue is also here, as I suggest changing it either to ...
$reposCount = @(repos).Count
Microsoft.PowerShell.Utility\Write-Verbose ('Selected {0} NuGet repositories.' -f $reposCount)
if ($reposCount) {
... or just convert the filtering result to an array: ...
$repos = @(
$PSGetRepositories.Values |
Microsoft.PowerShell.Core\Where-Object {$_.PackageManagementProvider -eq 'NuGet'-and $_.Name -ne 'PSGallery'} |
Microsoft.PowerShell.Utility\Select-Object Name, Trusted, SourceLocation
)
Microsoft.PowerShell.Utility\Write-Verbose ('Selected {0} NuGet repositories.' -f $repos.Count)
if ($repos.Count) {
... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching that, let me fix that |
||
|
||
if ($repos -ne $null) { | ||
if ($repos.Count) { | ||
$repos | Microsoft.PowerShell.Core\ForEach-Object { | ||
try { | ||
$message = 'Registering {0} at {1} -Trusted:${2} -Force:${3}.' -f $_.Name, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @alerickson for nitpicking, but do we need extra space here? And wouldn't it look better if the
$PSGetRepositories.Values
got moved to a new line instead: